Skip to main content

The official Python SDK for jsondb.cloud — a hosted JSON document database.

Project description

jsondb-cloud

The official Python SDK for jsondb.cloud — a hosted JSON document database.

PyPI version Downloads CI Python GitHub stars Last commit License: MIT PyPI - Python Version

Install

pip install jsondb-cloud

Quick Start

from jsondb_cloud import JsonDB

db = JsonDB(api_key="jdb_sk_live_xxxx")
users = db.collection("users")

# Create
user = users.create({"name": "Alice", "email": "alice@example.com"})

# Read
user = users.get(user["_id"])

# List with filtering
admins = users.list(filter={"role": "admin", "age": {"$gte": 21}}, sort="-createdAt", limit=10)

# Update
users.update(user["_id"], {"name": "Alice Updated", "email": "alice@example.com"})

# Patch (partial update)
users.patch(user["_id"], {"age": 31})

# Delete
users.delete(user["_id"])

Configuration

db = JsonDB(
    api_key="jdb_sk_live_xxxx",  # required
    project="v1",                 # project namespace (default: "v1")
    base_url="https://api.jsondb.cloud",  # API endpoint
    timeout=30.0,                 # request timeout in seconds
    max_retries=3,                # retries on 429/5xx errors
    headers={"X-Custom": "val"},  # extra headers for every request
)

AsyncJsonDB accepts the same options and supports async with for automatic cleanup.

API

All methods are available on both Collection (sync) and AsyncCollection (async).

Category Methods
CRUD create, get, list, update, patch, json_patch, delete
Bulk bulk_create, bulk
Count count
Schema get_schema, set_schema, remove_schema, validate
Versioning list_versions, get_version, restore_version, diff_versions
Webhooks create_webhook, list_webhooks, get_webhook, update_webhook, delete_webhook, test_webhook
Import/Export import_documents, export_documents

See the full API reference for details.

Async Usage

from jsondb_cloud import AsyncJsonDB

async with AsyncJsonDB(api_key="jdb_sk_live_xxxx") as db:
    users = db.collection("users")
    user = await users.create({"name": "Alice"})
    page = await users.list(filter={"role": "admin"})

Error Handling

from jsondb_cloud import JsonDB, NotFoundError, QuotaExceededError, JsonDBError

try:
    user = users.get("nonexistent")
except NotFoundError as e:
    print(f"Not found: {e.document_id}")
except QuotaExceededError as e:
    print(f"Limit: {e.limit}, Current: {e.current}")
except JsonDBError as e:
    print(f"Error: {e.code} - {e.message} (HTTP {e.status})")

Documentation

Full documentation at jsondb.cloud/docs/sdks/python.

Related Packages

Package Description
@jsondb-cloud/client JavaScript/TypeScript SDK
@jsondb-cloud/mcp MCP server for AI agents
@jsondb-cloud/cli CLI tool
jsondb-cloud (PyPI) Python SDK

License

MIT

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

jsondb_cloud-1.0.4.tar.gz (48.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jsondb_cloud-1.0.4-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file jsondb_cloud-1.0.4.tar.gz.

File metadata

  • Download URL: jsondb_cloud-1.0.4.tar.gz
  • Upload date:
  • Size: 48.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jsondb_cloud-1.0.4.tar.gz
Algorithm Hash digest
SHA256 de5d9fbcae6b19b1c3833da643b87e1c9ae3b363aebed8c160bbe4ff6da726c2
MD5 dbe4333fdd3df194ffd4bd86b626901d
BLAKE2b-256 3d11da2939543884790960d5ffd8af74df0da497ff7acc68fb9d8795d0d13633

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsondb_cloud-1.0.4.tar.gz:

Publisher: ci.yml on JsonDBCloud/python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jsondb_cloud-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: jsondb_cloud-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jsondb_cloud-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 38d899d5c851307c8df86ee3ac00aa1b3eeddac1dc5b112d602d6b6a7249c41a
MD5 3f5161d775bb8654d085ea81814304b2
BLAKE2b-256 11b8a7d563336bc20921978cda08573db8722ca1f49358088e54515ee73b51e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsondb_cloud-1.0.4-py3-none-any.whl:

Publisher: ci.yml on JsonDBCloud/python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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