Skip to main content

SDKs

Use the TypeScript or Python SDK when RushDB is part of your application, service, script, or data pipeline. Each SDK works with RushDB in one of two ways, with the same API:

RushDB CloudSelf-hosted engine (direct mode)
What you runNothing: the managed service at app.rushdb.comOne rushdb binary, on your own infrastructure
Connect withAn API keyThe engine URL and the engine token

The engine is what you can self-host. RushDB Cloud runs that engine for you and adds the dashboard, managed embeddings and the AI features (natural-language search, relationship-pattern suggestions), which exist only in RushDB Cloud.

PackageInstallVersion
@rushdb/javascript-sdknpm install @rushdb/javascript-sdk3.x — Node.js and browsers, zero runtime dependencies
rushdbpip install rushdb3.x — Python 3.10 or newer, no runtime dependencies

Connect​

import os
from rushdb import RushDB

# RushDB Cloud
db = RushDB(os.environ["RUSHDB_API_KEY"])

# A self-hosted engine
engine = RushDB(
os.environ["RUSHDB_TOKEN"],
direct=True,
engine_url="http://127.0.0.1:3000",
scope="tenant-1", # only for an engine started with --multitenant
)

Get an API key at app.rushdb.com, or start an engine with rushdb up (see Installation). direct: true without an engine URL throws instead of falling back to RushDB Cloud.


Write and Read​

The fastest useful test is a nested import followed by a search. Nested objects become linked records automatically.

db.records.import_json(
{
"name": "RushDB adoption",
"TASK": [
{"title": "Connect RushDB", "status": "done"},
{"title": "Query linked records", "status": "pending"},
],
},
label="PROJECT",
)

projects = db.records.find({
"labels": ["PROJECT"],
"where": {"TASK": {"status": "pending"}},
})
print(projects.total, projects.data)

The REST API is RushDB Cloud's; a self-hosted engine is reached through the SDKs or its own native protocol.


What Each Mode Offers​

FeatureCloudSelf-hosted engine
Records: create, read, update, set, upsert, delete, find with where, orderBy, select, groupBy✓✓
Relationships: attach/detach, relationships.createMany / deleteMany / find✓✓
Labels, properties, property values✓✓
Import JSON and CSV, export CSV✓✓
Keyword (BM25) search and text indexes✓✓
External vector indexes; vector and hybrid search with a queryVector you supply✓✓
Raw openCypher (query.raw)✓✓ (engine started with --languages cypher)
Schema (ai.getSchema, ai.getSchemaMarkdown)✓✓
Transactions✓✓
Managed embeddings: managed indexes, records.vectorSearch by text query✓—
Natural-language search (ai.search)✓—
Relationship-pattern suggestions (relationships.patterns.*)✓—
Project settings (settings.get), dashboard, projects, team access✓—

In both modes, a transaction stages record creates, updates, sets, deletes by id, attaches and imports; other writes are refused inside a transaction. See Transactions.

Errors in direct mode​

ErrorRaised whenFields
CloudOnlyErrorA Cloud-only method or form is called. Nothing is sent, and no request ever goes to RushDB Cloud.method, reason, code: 'CLOUD_ONLY'
DirectModeErrorA write the engine cannot stage is called inside a transaction. Nothing is sent.code: 'DIRECT_MODE_UNSUPPORTED'

The lists are available in code, so an application can decide at runtime:

from rushdb import CLOUD_ONLY_METHODS, CloudOnlyError, is_cloud_only_method

The native protocol from the SDK​

In direct mode, any Protocol v1 operation the SDK has no method for is one call away: db.engine.execute(operation) in Python.

schema = engine.engine.execute({"kind": "describe", "describe": {"kind": "capabilities"}})

  1. Keyword search works as soon as you declare a text index.
  2. For vector search, create an embedding index — managed on Cloud, or external with your own vectors anywhere — and wait until its status is ready.
  3. Run semantic or hybrid search.

For natural-language query planning over your schema on RushDB Cloud, see Smart Search.

Full References​