diff --git a/README.md b/README.md index 1927acd..aea6708 100644 --- a/README.md +++ b/README.md @@ -18,23 +18,23 @@ You can establish a connection to the MindsDB server using the SDK. Here are som ```python import mindsdb_sdk -server = mindsdb_sdk.connect() -server = mindsdb_sdk.connect('http://127.0.0.1:47334') +con = mindsdb_sdk.connect() +con = mindsdb_sdk.connect('http://127.0.0.1:47334') ``` #### Connect to the MindsDB Cloud ```python import mindsdb_sdk -server = mindsdb_sdk.connect(login='a@b.com', password='-') -server = mindsdb_sdk.connect('https://cloud.mindsdb.com', login='a@b.com', password='-') +con = mindsdb_sdk.connect(login='a@b.com', password='-') +con = mindsdb_sdk.connect('https://cloud.mindsdb.com', login='a@b.com', password='-') ``` #### Connect to a MindsDB Pro server ```python import mindsdb_sdk -server = mindsdb_sdk.connect('http://', login='a@b.com', password='-', is_managed=True) +con = mindsdb_sdk.connect('http://', login='a@b.com', password='-', is_managed=True) ``` ## Basic usage @@ -43,7 +43,7 @@ Once connected to the server, you can perform various operations. Here are some ```python # Get a list of databases -databases = server.list_databases() +databases = con.databases.list() # Get a specific database database = databases[0] # Database type object @@ -53,24 +53,27 @@ query = database.query('select * from table1') print(query.fetch()) # Create a table -table = database.create_table('table2', query) +table = database.tables.create('table2', query) # Get a project -project = server.get_project('proj') +project = con.projects.proj + +# or use mindsdb project +project = con # Perform an SQL query within a project query = project.query('select * from database.table join model1') # Create a view -view = project.create_view('view1', query=query) +view = project.views.create('view1', query=query) # Get a list of views -views = project.list_views() +views = project.views.list() view = views[0] df = view.fetch() # Get a list of models -models = project.list_models() +models = project.models.list() model = models[0] # Use a model for prediction @@ -83,7 +86,7 @@ timeseries_options = { 'window': 5, 'horizon': 1 } -model = project.create_model( +model = project.models.create( 'rentals_model', predict='price', query=query, @@ -98,6 +101,10 @@ You can find more examples in this [Google colab notebook]( https://colab.research.google.com/drive/1QouwAR3saFb9ffthrIs1LSH5COzyQa11#scrollTo=k6IbwsKRPQCR ) +## Examples + +https://github.com/mindsdb/mindsdb_python_sdk/tree/staging/examples + ## API Documentation The API documentation for the MindsDB SDK can be found at https://mindsdb.github.io/mindsdb_python_sdk/. You can generate the API documentation locally by following these steps: