Skip to main content

DBCenter

A real PostgreSQL, embedded in your process. No server to install, no Docker, no connection string to configure - the binaries are fetched once and the database runs as a child process against a directory you choose.

from dbcenter import DBCenter

db = DBCenter(path="./data")
users = db.collection("users")
users.insert_one({"name": "Ada", "age": 36})
print(users.find({"age": {"$gt": 30}}))

Because it is PostgreSQL rather than an imitation of it, the extensions come too. PostGIS and pgvector are downloaded and installed on first use:

db.install_extension("postgis")
db.query("""
    SELECT ST_Distance(
        ST_SetSRID(ST_MakePoint(29.0, 41.0), 4326)::geography,
        ST_SetSRID(ST_MakePoint(32.85, 39.93), 4326)::geography
    ) / 1000 AS km
""")

store = db.vector_store("documents", dimension=1536)
store.add(ids=["a"], embeddings=[[0.1] * 1536])

Fuzzy text search is pg_trgm, which ships with PostgreSQL:

db.collection("cities").fuzzy_search("Istanbu", "name")

What you get

  • A real PostgreSQL. Its planner, its transactions, its types. db.query() takes any SQL, with bound parameters.
  • PostGIS and pgvector, installed on demand. The Linux PostGIS build carries its own GEOS and PROJ, so it works on a machine with nothing installed.
  • A collection API over ordinary relational tables. Columns are added as documents introduce fields.
  • Sync to storage, optionally, with multi_user_sync=True and a SyncEngine: a local directory or Google Drive from Python, and S3 or anything S3-compatible through the dbcenter-serve container. Tables are written as Parquet with a column per field, and columnar=True reads them back through DuckDB for aggregates.

Notes

The PostgreSQL distribution is downloaded to ~/.dbcenter on first use, about 60MB, and reused after that. Extension archives are verified against digests pinned in the source, so a substituted one is refused.

PostgreSQL refuses to run as root, so neither can this. In a container that runs as root - which most base images do - create a user first and start the database as them; the error says so if you forget.

In Google Colab, which runs everything as root, create a user and run your script as them, with a data directory they can write to:

!id -u dbuser >/dev/null 2>&1 || useradd -m dbuser
!sudo -u dbuser python3 /path/to/your_script.py

Extensions are built per PostgreSQL major version. Asking for one with no published build is an error naming the versions that exist, rather than a download that fails later.

MIT licensed. Source at github.com/heyobi/dbcenter.

Metadata

Release files for dbcenter 0.4.2

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

Built distributions (wheels)

Table of built distributions (wheels) for dbcenter 0.4.2
File Actions
dbcenter-0.4.2-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details for dbcenter-0.4.2-cp38-abi3-win_amd64.whl
dbcenter-0.4.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details for dbcenter-0.4.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
dbcenter-0.4.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details for dbcenter-0.4.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
dbcenter-0.4.2-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details for dbcenter-0.4.2-cp38-abi3-macosx_11_0_arm64.whl
dbcenter-0.4.2-cp38-abi3-macosx_10_12_x86_64.whl CPython 3.8 abi3 macOS 10.12+ x86-64 Details for dbcenter-0.4.2-cp38-abi3-macosx_10_12_x86_64.whl

Total release size: 32.0 MB

Release files / dbcenter-0.4.2-cp38-abi3-win_amd64.whl

Download URL dbcenter-0.4.2-cp38-abi3-win_amd64.whl
Size 6.8 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
501c43522ff271a9d55ad9c935388503e97fc2b47b9ebff9b4776a61dc194b17
BLAKE2b-256 checksum
How to use checksums
7467aecf1a3ec814523c80fa2a349b278701e711bfd1b0c370b3891c7d84db80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / dbcenter-0.4.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL dbcenter-0.4.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.6 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
c86550eda7ad7cb02e26583954df04f09c2015efe34b4fba554a64f6dcf342e0
BLAKE2b-256 checksum
How to use checksums
2c244ab2ec73f17e57b677e4bc462a3338324edde7c004c1edc75db8027bdde5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / dbcenter-0.4.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL dbcenter-0.4.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 6.2 MB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
c5a988c53782177c9347781c3ddcc968f857eba3cc2cdfabe21bf9e721919ccd
BLAKE2b-256 checksum
How to use checksums
4da509ea880bb6aa70468124a8d62083f12102aae8a6ee9b9b199f4a21fe2d57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / dbcenter-0.4.2-cp38-abi3-macosx_11_0_arm64.whl

Download URL dbcenter-0.4.2-cp38-abi3-macosx_11_0_arm64.whl
Size 5.9 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4553fcd03ed9acb6d582b8f752f7686911bc000cd550659d60b5e8dcbf5c3457
BLAKE2b-256 checksum
How to use checksums
385f7a408b915da1f7181a968bb08c7c43c0c3601dfefe5224744efc26177901
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / dbcenter-0.4.2-cp38-abi3-macosx_10_12_x86_64.whl

Download URL dbcenter-0.4.2-cp38-abi3-macosx_10_12_x86_64.whl
Size 6.4 MB
Tags CPython 3.8 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
fa8e26d8a1fabe43d93d544666b6d164eef21e6dfb3db07007c811766be16d50
BLAKE2b-256 checksum
How to use checksums
de4ce992fd4da2f2709fc1614dc9a36b2b0992e2fa382200c7b52ade8eaede1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Security for dbcenter 0.4.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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