Pure Python in-memory database with SQL-like queries
Project description
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 isdictdb.
Features
- SQL-like CRUD —
insert,select,update,delete - Query DSL —
table.age >= 18,table.name.startswith("A") - Aggregations —
Count,Sum,Avg,Min,MaxwithGROUP 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
License
Apache 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01eb09e47351c95be23e7f7aa45731a3542ecd7b94d11ceef39fd0b8b8e2a010
|
|
| MD5 |
3162aebd2905181aaa2a2a7bed49277f
|
|
| BLAKE2b-256 |
efe9ad5fc638c7ad99be22ead26991b3af1c5264ac52abd5e5f9b441510df582
|
Provenance
The following attestation bundles were made for dctdb-1.5.0.tar.gz:
Publisher:
publish.yml on mhbxyz/dictdb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dctdb-1.5.0.tar.gz -
Subject digest:
01eb09e47351c95be23e7f7aa45731a3542ecd7b94d11ceef39fd0b8b8e2a010 - Sigstore transparency entry: 850023010
- Sigstore integration time:
-
Permalink:
mhbxyz/dictdb@ebabbf74258d1cde5bccbd25c7a4325524de4c58 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mhbxyz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ebabbf74258d1cde5bccbd25c7a4325524de4c58 -
Trigger Event:
workflow_dispatch
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2697edc028c21894e5dda38b8a8816754d16ed1fc42d4a9efa526030dfc3a00c
|
|
| MD5 |
78d504566cad1e9ee17f28ca39ead1b8
|
|
| BLAKE2b-256 |
e88f3180cd65e1e28ccaa38bfeed882f91bed428bacb47e0b5d9de2e14de773a
|
Provenance
The following attestation bundles were made for dctdb-1.5.0-py3-none-any.whl:
Publisher:
publish.yml on mhbxyz/dictdb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dctdb-1.5.0-py3-none-any.whl -
Subject digest:
2697edc028c21894e5dda38b8a8816754d16ed1fc42d4a9efa526030dfc3a00c - Sigstore transparency entry: 850023012
- Sigstore integration time:
-
Permalink:
mhbxyz/dictdb@ebabbf74258d1cde5bccbd25c7a4325524de4c58 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mhbxyz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ebabbf74258d1cde5bccbd25c7a4325524de4c58 -
Trigger Event:
workflow_dispatch
-
Statement type: