Skip to main content

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.

Installation

pip install dctdb

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

Features

  • SQL-like CRUD — insert, select, update, delete, upsert
  • Query DSL — table.age >= 18, table.name.like("A%"), table.salary.between(50000, 100000)
  • Logical operators — And, Or, Not for readable complex queries
  • Aggregations — Count, Sum, Avg, Min, Max with GROUP BY
  • Indexes — Hash (O(1) lookup) and Sorted (range queries)
  • Schemas — Optional type validation
  • CSV import/export — Load from and save to CSV files
  • Persistence — JSON and Pickle formats with async support
  • Automatic backups — Periodic and incremental backup manager
  • Thread-safe — Reader-writer locks per table

Quick Example

from dictdb import DictDB, And, 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 (Condition wrapper is optional)
users.select(where=users.age >= 25)
users.select(where=users.dept == "IT", order_by="-age", limit=10)

# Combine conditions with And/Or/Not
users.select(where=And(users.dept == "IT", users.age >= 25))

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

# Persistence
db.save("data.json", file_format="json")

CSV Import/Export

# Import CSV into a new table
db.import_csv("users.csv", "users", primary_key="id")

# Export table to CSV
users.export_csv("backup.csv")
users.export_csv("it_dept.csv", where=users.dept == "IT")

Documentation

mhbxyz.github.io/dictdb

License

Apache 2.0

Metadata

Release files for dctdb 1.11.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 dctdb 1.11.0
File Size Uploaded
dctdb-1.11.0.tar.gz 245.9 kB Details

Built distribution (wheel)

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

Total release size: 298.9 kB

Release files / dctdb-1.11.0.tar.gz

Download URL dctdb-1.11.0.tar.gz
Size 245.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1b68d2ea3b7faa68a01abe6135565a3032b7bb2a532517a6fb8fe34989a536d0
BLAKE2b-256 checksum
How to use checksums
67b58a523b64590a86ad810bd37c8456d0e39f8c32d13b65891a26ff29fff64a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 24, 2026.

Transparency log

Release files / dctdb-1.11.0-py3-none-any.whl

Download URL dctdb-1.11.0-py3-none-any.whl
Size 53.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
28e143955ced8f0e6d184574a98357c55bc873b990365b981582228716b5473c
BLAKE2b-256 checksum
How to use checksums
a9da7ed6434b08a901225a66902e63167a2264d1ae9f34de50495b22eb7b85d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.11.0 This release

2 release files

1.5.0

2 release files

1.0.0

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