- API version: 1.1.3
This is a Client SDK for RelationalAI API
For more information, please visit https://www.relational.ai
Building the python SDK requires:
- python 3
- poetry
To install the SDK to your local poetry repository, you can run from the client directory:
# using poetry
poetry add relationalai-sdk
# using pip
pip install relationalai-sdk
To connect to a local rai-server you need to create a LocalConnection
:
>>> from relationalai import LocalConnection
>>> conn = LocalConnection(dbname="python_sdk_db")
>>> conn.create_database(overwrite=True)
To connect to RAICloud you need to create two connections:
ManagementConnection
to manage RAICloud resources.Connection
to connect to a RAICloud compute.
>>> from relationalai import Connection, ManagementConnection, RAIComputeSize, RAIComputeFilters
>>> mngt_conn = ManagementConnection()
>>> mngt_conn.create_compute(compute_name="python_sdk_compute", size=RAIComputeSize("XS"))
>>> filters = RAIComputeFilters(state=["PROVISIONED"])
>>> mngt_conn.list_computes(filters=filters)
>>> conn = Connection(mngt_conn=mngt_conn, compute_name="python_sdk_compute", dbname="python_sdk_db")
>>> conn.create_database(overwrite=True)
>>> mngt_conn.delete_compute(compute_name="python_sdk_compute")
You can get python3
and poetry
using Nix
:
nix-shell -p poetry python3