Skip to main content

Pure Python in-memory database with SQL-like queries

Project description

DictDB Logo

CI License Python 3.13+ Code style: Ruff Type checking: MyPy


DictDB is a pure Python in-memory database with SQL-like queries. Zero dependencies.

Installation

pip install dctdb

The PyPI package is dctdb, but the import is dictdb.

Features

  • SQL-like CRUDinsert, select, update, delete
  • Query DSLtable.age >= 18, table.name.startswith("A")
  • AggregationsCount, Sum, Avg, Min, Max with GROUP BY
  • Indexes — Hash (O(1) lookup) and Sorted (range queries)
  • Schemas — Optional type validation
  • Persistence — JSON and Pickle formats
  • Thread-safe — Reader-writer locks

Quick Example

from dictdb import DictDB, Condition, Count, Avg

db = DictDB()
db.create_table("users", primary_key="id")
users = db.get_table("users")

# Insert
users.insert({"name": "Alice", "age": 30, "dept": "IT"})
users.insert({"name": "Bob", "age": 25, "dept": "HR"})

# Query with DSL
users.select(where=Condition(users.age >= 25))
users.select(where=Condition(users.dept == "IT"), order_by="-age", limit=10)

# Aggregations
users.aggregate(count=Count(), avg_age=Avg("age"))
users.aggregate(group_by="dept", count=Count())

# Persistence
db.save("data.json")

Documentation

mhbxyz.github.io/dictdb

License

Apache 2.0

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

dctdb-1.5.0.tar.gz (193.3 kB view details)

Uploaded Source

Built Distribution

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

dctdb-1.5.0-py3-none-any.whl (40.7 kB view details)

Uploaded Python 3

File details

Details for the file dctdb-1.5.0.tar.gz.

File metadata

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

File hashes

Hashes for dctdb-1.5.0.tar.gz
Algorithm Hash digest
SHA256 01eb09e47351c95be23e7f7aa45731a3542ecd7b94d11ceef39fd0b8b8e2a010
MD5 3162aebd2905181aaa2a2a7bed49277f
BLAKE2b-256 efe9ad5fc638c7ad99be22ead26991b3af1c5264ac52abd5e5f9b441510df582

See more details on using hashes here.

Provenance

The following attestation bundles were made for dctdb-1.5.0.tar.gz:

Publisher: publish.yml on mhbxyz/dictdb

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

File details

Details for the file dctdb-1.5.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for dctdb-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2697edc028c21894e5dda38b8a8816754d16ed1fc42d4a9efa526030dfc3a00c
MD5 78d504566cad1e9ee17f28ca39ead1b8
BLAKE2b-256 e88f3180cd65e1e28ccaa38bfeed882f91bed428bacb47e0b5d9de2e14de773a

See more details on using hashes here.

Provenance

The following attestation bundles were made for dctdb-1.5.0-py3-none-any.whl:

Publisher: publish.yml on mhbxyz/dictdb

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