Package com.mindsdb.services
Class DatasourcesService
java.lang.Object
com.mindsdb.services.DatasourcesService
Service class for managing data sources.
Provides methods to create, retrieve, list, and delete data sources using a REST client.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreate
(DatabaseConfig databaseConfig) Creates a new data source with the given database configuration.create
(DatabaseConfig databaseConfig, boolean replace) Creates a new data source with the given database configuration, with an option to replace an existing data source.void
Deletes a specific data source by name.Retrieves a specific data source by name.list()
Retrieves a list of all data sources.
-
Constructor Details
-
DatasourcesService
-
-
Method Details
-
create
Creates a new data source with the given database configuration.- Parameters:
databaseConfig
- the configuration of the database to create a data source for- Returns:
- the created Datasource object
- Throws:
Exception
- if an error occurs during the creation process
-
create
Creates a new data source with the given database configuration, with an option to replace an existing data source.- Parameters:
databaseConfig
- the configuration of the database to create a data source forreplace
- if true, replaces the existing data source with the same name- Returns:
- the created Datasource object
- Throws:
Exception
- if an error occurs during the creation process
-
list
Retrieves a list of all data sources.- Returns:
- an Optional containing a list of Datasource objects, or an empty Optional if no data sources are found
- Throws:
Exception
- if an error occurs during the retrieval process
-
get
Retrieves a specific data source by name.- Parameters:
datasourceName
- the name of the data source to retrieve- Returns:
- an Optional containing the Datasource object, or an empty Optional if not found
- Throws:
Exception
- if an error occurs during the retrieval process
-
drop
Deletes a specific data source by name.- Parameters:
datasourceName
- the name of the data source to delete- Throws:
Exception
- if an error occurs during the deletion process
-