Skip to main content

Python SDK

Push JSON, query by value or meaning, traverse graphs — from Python.

Install

pip install rushdb

Connect

from rushdb import RushDB

db = RushDB("RUSHDB_API_KEY")

Get your API token from the RushDB Dashboard.

First write

# Nested objects become linked records automatically
db.records.create_many(
label="MOVIE",
data={
"title": "Inception",
"rating": 8.8,
"genre": "sci-fi",
"ACTOR": [
{"name": "Leonardo DiCaprio", "country": "USA"},
{"name": "Ken Watanabe", "country": "Japan"}
]
}
)
# Created: MOVIE → ACTOR × 2 (relationships wired automatically)

First read

result = db.records.find({
"labels": ["MOVIE"],
"where": {"rating": {"$gte": 8}},
"limit": 10
})

for movie in result:
print(movie["title"])

print(f"{result.total} total")

Configuration

ParameterDefaultDescription
api_keyYour RushDB API token (required)
urlhttps://app.rushdb.comRushDB instance URL
# Self-hosted instance
db = RushDB("RUSHDB_API_KEY", url="https://your-rushdb-instance.com")

Namespaces

NamespacePurpose
db.recordsCreate, read, update, delete records
db.relationshipsAttach / detach record links
db.labelsList labels in the database
db.propertiesInspect property metadata
db.transactionsBegin / commit / rollback
db.aiOntology, embedding indexes, semantic search