Skip to main content

cutedb — Python client

Client for CuteDB, the cute embedded document database. Talks to cutedb-server over HTTP.

Built by Gravicode Studios, led by Kang Fadhil.

pip install cutedb

Standard library only — no dependencies, ever. Python 3.10+.

Use

from decimal import Decimal
from cutedb import CuteClient, CuteQueryError

with CuteClient("http://127.0.0.1:8420") as db:
    orders = db.collection("orders")

    # Decimal is encoded with its exact digits rather than through float, so an invoice total
    # that was exact stays exact.
    orders.insert({"customer": {"name": "Sari"}, "total": Decimal("249000.00")})

    # One request, one lock, one flush — not a loop.
    ids = orders.insert_many([{"n": i} for i in range(10_000)])

    result = db.query(
        "SELECT address.city AS city, SUM(total) AS revenue "
        "FROM orders WHERE status = @status GROUP BY address.city",
        {"status": "selesai"},
    )

    for row in result:                        # results are iterable
        print(row["city"], row["revenue"])

    print(result.plan)                        # how the engine found them

Bind values through parameters rather than building the statement by concatenation: a bound value is used as a value and can never be reinterpreted as syntax.

Notes

  • get, delete and drop_index return None/False for a missing target rather than raising. "It was not there" is an answer, not an error.
  • CuteQueryError carries the server's caret line pointing at the offending character, so printing it is usually the most useful thing to do.
  • The client holds no session state, so one instance is safe to share across threads.

Running the server

dotnet tool install -g CuteDB.Server
cutedb-server shop.cute --port 8420

Links

MIT licensed.

Metadata

Release files for cutedb 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cutedb 2.0.0
File Size Uploaded
cutedb-2.0.0.tar.gz 8.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cutedb 2.0.0
File Interpreter ABI Platform
cutedb-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.4 kB

Release files / cutedb-2.0.0.tar.gz

Download URL cutedb-2.0.0.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
91b9dace98e6461a40febac846e15ac7637f47016191918c3a91108e09cea0f0
BLAKE2b-256 checksum
How to use checksums
dc7388ff54f10fef0bdac5fbf32ad3abbbbceb955c3a1c356b8531d5782da6bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / cutedb-2.0.0-py3-none-any.whl

Download URL cutedb-2.0.0-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cccd241de27b97d051c89e4adb10211f95198ad538832d932277986c2c008448
BLAKE2b-256 checksum
How to use checksums
ff6bb7c2d020ab3867b441ad1ff1bb6435f168a8cf8ce6b659bd1cf428b40934
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page