Skip to main content

MindsDB Python SDK, provides an SDK to use a remote mindsdb instance

Project description

Python MindsDB SDK

It enables you to connect to a midnsDB server and use it in a similar way to mindsb_native.

Install

pip install mindsdb_sdk

Example

Connect:

import mindsdb_sdk

# Connect to local server 

server = mindsdb_sdk.connect()
server = mindsdb_sdk.connect('http://127.0.0.1:47334')

# Connect to cloud server

server = mindsdb_sdk.connect(email='a@b.com', password='-')
server = mindsdb_sdk.connect('https://cloud.mindsdb.com', email='a@b.com', password='-')

Base usage:

# database
databases = server.list_databases()

database = databases[0] # Database type object

# sql query
query = database.query('select * from table1')
print(query.fetch())

# create table
table = database.create_table('table2', query)


# project
project = server.get_project('proj')

# sql query
query = project.query('select * from database.table join model1')

# create view
view = project.create_view(
      'view1',
       query=query
)

# get view
views = project.list_views()
view = views[0]
df = view.fetch()

# get model
models = project.list_models()
model = models[0]

# using model
result_df = model.predict(df)
result_df = model.predict(query)

# create model
model = project.create_model(
      'rentals_model',
      predict='price',
      query=query,
)

API documentation

Generating:

pip install sphinx

cd docs

make html

API documentation will be generated in docs/build/html

How to test

It runs all tests for components

env PYTHONPATH=./ pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mindsdb_sdk-1.0.0.tar.gz (11.1 kB view details)

Uploaded Source

File details

Details for the file mindsdb_sdk-1.0.0.tar.gz.

File metadata

  • Download URL: mindsdb_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.16

File hashes

Hashes for mindsdb_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e9c490d6c8191502f623cabaa3ff44b76d5cf9857adb1041702c23db57868e30
MD5 9e7884e2dd30a987f67b9e72d8b3494f
BLAKE2b-256 29ddb674945e94784dbc9dcdf6115808b48723e36967523470a8d7e4a3784347

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page