OrbexDB Connect Python SDK
Connect Python applications and Genorbex notebooks directly to OrbexDB. The SDK uses the OrbexDB native query API and has no third-party dependencies.
Installation
python -m pip install orbexdb-connect
Create an OrbexDB connection/API key in the OrbexDB connection settings, then configure the SDK:
export ORBEXDB_API_KEY="your-64-character-api-key"
export ORBEXDB_DATABASE_ID="your-database-id"
Managed Genorbex notebooks can use the injected runtime token instead:
from orbexdb_connect import connect
db = connect(database_id="your-database-id")
For an external Python application:
from orbexdb_connect import connect
db = connect(
database_id="your-database-id",
api_key="your-api-key",
schema="PUBLIC",
)
Table operations
db.create_table(
"customers",
{
"id": "NUMBER NOT NULL",
"name": "VARCHAR(100)",
"email": "VARCHAR(255)",
"active": "BOOLEAN",
},
)
db.insert("customers", {
"id": 1,
"name": "Ada",
"email": "ada@example.com",
"active": True,
})
db.insert("customers", [
{"id": 2, "name": "Grace", "email": "grace@example.com", "active": True},
{"id": 3, "name": "Linus", "email": "linus@example.com", "active": False},
])
db.update("customers", {"active": False}, where={"id": 2})
db.delete("customers", where={"id": 3})
db.merge(
"customers",
[
{"id": 1, "name": "Ada Lovelace", "email": "ada@example.com", "active": True},
{"id": 4, "name": "Margaret", "email": "margaret@example.com", "active": True},
],
key_columns=["id"],
)
result = db.query("SELECT id, name FROM customers ORDER BY id")
for row in result:
print(row["id"], row["name"])
db.truncate_table("customers")
db.drop_table("customers")
update and delete require a where mapping by default. To intentionally
affect every row, pass allow_all=True.
Metadata
schemas = db.list_schemas()
tables = db.list_tables()
columns = db.describe_table("customers")
Raw SQL
Any SQL operation supported by OrbexDB can be executed directly:
result = db.execute("SELECT CURRENT_TIMESTAMP AS now")
print(result.first())
Configuration can also be supplied using ORBEXDB_TOKEN, ORBEXDB_USERNAME
and ORBEXDB_PASSWORD, ORBEXDB_BASE_URL, and ORBEXDB_DATABASE_ID.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file orbexdb_connect-0.1.0.tar.gz.
File metadata
- Download URL: orbexdb_connect-0.1.0.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2cedfb0a3350afeb973ef0cd9b576df740600badf3b5eadc65dcbf53903637a
|
|
| MD5 |
e1d32fd8d129f87ae7ce45beae4ad928
|
|
| BLAKE2b-256 |
028aa16f39035036ecda3ca9afb1b81cbd056cb65ff26f47010c0ea33557a73b
|
File details
Details for the file orbexdb_connect-0.1.0-py3-none-any.whl.
File metadata
- Download URL: orbexdb_connect-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
373ee896f11ae67ccb17d656306da585f784310589506165181df0adfff1bdc6
|
|
| MD5 |
88d36d07893f863daf4da2ff67e169cd
|
|
| BLAKE2b-256 |
aec7db97e6819e859b5050dbcc3add34a8fc8d7f639f84ec1c0165eba276e8ef
|