Class Databases

java.lang.Object
mindsdb.services.Databases

public class Databases extends Object
The Databases class provides methods to list, create, and drop databases.

Example usage:

 
 // List all databases
 databases.list();
 
 // Get database by name
 Database db = databases.get("example_db");
 
 // Create a new database
 Database db = databases.create("example_db", "postgres", Map.of("host", ""));
 
 // Drop a database
 databases.drop("example_db");
 
 // Get an existing database
 Database db = databases.get("example_db");
 
 
  • Constructor Details

    • Databases

      public Databases(RestAPI api)
      Create a new Databases object
      Parameters:
      api - - RestAPI object
  • Method Details

    • list

      public List<Database> list()
      List all databases
      Returns:
      List of databases
    • get

      public Database get(String name)
      Get database by name
      Parameters:
      name - - database name
      Returns:
      Database object
    • create

      public Database create(String name, String engine, Map<String,String> connectionArgs)
      Create a new database
      Parameters:
      name - - database name
      engine - - database engine
      connectionArgs - - database connection arguments
      Returns:
      Database object
    • drop

      public void drop(String name)
      Drop database by name
      Parameters:
      name - - database name