Skip to main content

ConstDB is a very simple and fast read-only embedded key-value database. Keys consist of 64-bit integers or strings and values consist of arbitrary byte strings.

Sample

import constdb

with constdb.create('db_name') as db:
    db.add(-2, b'7564')
    db.add(3, b'23')
    db.add(-1, b'66')

with constdb.read('db_name') as db:
    assert db.get(-2) == b'7564'
    assert db.get(-1) == b'66'
    assert db.get(3) == b'23'

Documenation

ConstDB contains only two functions: create and read.

create(filename) allows you to create a new ConstDB database. It takes a filename and returns a ConstDBWriter. A ConstDBWriter has two methods:

  • add(key, value): Adds a key-value pair to the database. The key must be a 64 bit integer or a string. The value must be a byte string.

  • close(): Finalize and close the database.

read(filename) allows you to read an existing ConstDB database. It takes a filename and returns a ConstDBReader. A ConstDBReader has two methods:

  • get(key): Get a value from the database. The key must be a 64 bit integer or a string. Returns the value if the key is in the database. Returns None if the key is not found.

  • close(): Finalize and close the database.

Requirements

The only requirement for ConstDB is Python 3.

Release files for constdb 4.1.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 constdb 4.1.0
File Size Uploaded
constdb-4.1.0.tar.gz 5.1 kB Details

Built distribution (wheel)

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

Total release size: 8.9 kB

Release files / constdb-4.1.0.tar.gz

Download URL constdb-4.1.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d2b9968d2f4066c64780eed79853ee8ded74b4ba573d5f224db528b9c707a272
BLAKE2b-256 checksum
How to use checksums
3ba750b83435b2197f052b67895e941addf3be652950a0dfa67f16abaddb5a3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.12

Release files / constdb-4.1.0-py3-none-any.whl

Download URL constdb-4.1.0-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee2ee169bd9edf48bda6b207d29e3940d9df1444f68f17c74c64e66eb60a7e3d
BLAKE2b-256 checksum
How to use checksums
0abed43b45f27c78257927120eb0981d1c3a90469d1a77bd270b4d36d4fc79b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.12

Release history Release notifications | RSS feed

This release

4.1.0 This release

2 release files

4.0.0

2 release files

3.3.0

1 release file

3.2.0

1 release file

3.1.0

1 release file

3.0.0

1 release file

2.0.0

2 release files

1.0.2

2 release files

1.0.1

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