Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

PacificDB

PacificDB Python client

Version 1.2.0rc2 — prerelease. Download the matching package from the Community v1.2.0-rc.2 release; registry publication is pending.

A database-first client for the Community engine. Requires Python 3.10 or later; no runtime dependencies. These examples describe the 1.2.0-rc.2 prerelease. The new APIs require its published wheel or tagged-source build, not an older registry release.

Start a PacificDB server, then connect to a database directly:

import os
from pacificdb import PacificDB, PacificDBError

url = os.environ.get('PACIFICDB_URL', 'pacificdb://localhost:9000/app')
with PacificDB.connect(url) as db:
    db.create_database()             # create the URL's database and select it
    db.create_collection('users')
    db.insert('users', {'id': '1', 'name': 'Ada'})
    print(db.find_one('users', {'id': '1'}))
    db.update_one('users', {'id': '1'}, {'$set': {'name': 'Grace'}})
    print(db.count('users'))

Create calls are not implicit or idempotent: omit them when the database or collection already exists. No project or separate selection call is required. The existing PacificDBClient(host, port, user_id, database, use_tls, ca_file, timeout) constructor still works. PacificDB is its shorter alias.

connect(url, **options) eagerly authenticates URL credentials and checks the connection with ping; from_url(url, **options) connects lazily on the first request. URL credentials must contain both username and password. Use an environment variable for private URLs, not a literal in source or logs. Use pacificdbs:// for TLS with verified hostname and default trust, or provide ca_file='/path/to/ca.pem'. Authentication on plain TCP does not encrypt traffic.

URL defaults: port 9000, user system, 30-second deadline, pool size 16. Query keys are userId, timeoutMs, poolSize, caFile; duplicate/unknown keys and conflicting explicit options fail before connecting. Python options use user_id, timeout (seconds), pool_size, ca_file. Pools are limited to 32; responses default to a 64 MiB limit (max_response_bytes can lower it). Idle connections are reused only when the engine explicitly advertises keepalive.

Database methods: create_database(name=None, db_type='binary'), list_databases(), use_database(name), drop_database(name=None). Creation selects on success; switching checks the engine's authorized listing. Failed create/switch/drop calls preserve selection; dropping the selected database clears it. create_collection, list_collections, and drop_collection operate on the selected database.

Document methods: insert, insert_many, find, find_one, count, aggregate, explain, update_one, update_many, delete_one, delete_many, bulk_write. find(collection, filter=None, limit=-1, offset=0) returns the original engine response; find_one returns the first document or None. list_databases returns a list of names. Other methods preserve protocol responses, including partial bulk results. Use capabilities() for the server's feature report, and request({...}) for raw protocol access. The engine remains responsible for namespace rules and authorization.

Every operation snapshots selected scope and caller JSON before network I/O. Do not mutate input while the method itself is copying it. Selection is shared client state; use separate clients when independent concurrent selection is needed. A completed drop cannot clear a newer selection of another database.

PacificDBError preserves .code and a sanitized .response. Known credentials are redacted from error diagnostics. Successful document values are unchanged. A disconnect/timeout after sending a write can have an unknown outcome: writes are never silently retried. The deadline covers pool waiting and socket I/O; OS DNS resolution can exceed it. close() is idempotent and wakes queued calls; always use a context manager or close explicitly.

Media and backups

from pathlib import Path

# Small in-memory attachments; normal collection documents.
db.media.put('assets', 'logo', b'\x00\xff', {'contentType': 'image/png'})
attachment = db.media.get('assets', 'logo')  # data: bytes, metadata: dict

# Files are hashed and transferred in bounded chunks.
manifest = db.media.upload_file('assets', Path('video.mp4'))
db.media.download_file(manifest['id'], Path('download.mp4'), collection='assets')
backup = db.backups.create(description='before maintenance')
db.backups.export(backup['backup_id'], Path('backup.json'))

On interrupted uploads, catch MediaUploadError and inspect upload_id, next_chunk, received_chunks, received_bytes and resumable. Resume explicitly with the same file, collection and chunk setting: db.media.upload_file('assets', path, resume=error.upload_id). A lost acknowledgement can mean a chunk was stored; resume asks the server which chunks exist and skips them. It never replays a write automatically.

Uploads reject empty/nonregular files and changed content. File downloads require a selected database and validate the returned database/optional collection, chunk sizes/indexes/base64/SHA-256 and whole file. Downloads and backup exports write a private unique sibling temporary file, then replace the destination only after verification. The parent directory must exist. Backup export streams the existing pacificdb-full-backup-v1 JSON format; it is not an engine restore API. Filesystem errors are typed errors. Each network call has a deadline; an entire multi-chunk transfer has no single overall deadline. In-memory attachments allocate the supplied bytes; use the file APIs for large media.

Apache-2.0. Stable-release and registry qualification remain separate.

Advanced named operations and wire aliases are documented in SDK capabilities.

Metadata

Release files for pacificdb 1.2.0rc2

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

Source distribution (sdist)

Source distribution for pacificdb 1.2.0rc2
File Size Uploaded Provenance Actions
pacificdb-1.2.0rc2.tar.gz 34.1 kB With provenance Details for pacificdb-1.2.0rc2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pacificdb 1.2.0rc2
File Interpreter ABI Platform Actions
pacificdb-1.2.0rc2-py3-none-any.whl Python 3 none any Details for pacificdb-1.2.0rc2-py3-none-any.whl

Total release size: 57.5 kB

Release files / pacificdb-1.2.0rc2.tar.gz

Download URL pacificdb-1.2.0rc2.tar.gz
Size 34.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d155699b2abbb1521f9fa78ce730019ef261e819ceb579598e2b259619dc8a3b
BLAKE2b-256 checksum
How to use checksums
5bb318bc4f15e48a1e2adae1c374d180873c006fe46864509883e36d8b8c5654
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 Nov 1, 2026.

Transparency log

Release files / pacificdb-1.2.0rc2-py3-none-any.whl

Download URL pacificdb-1.2.0rc2-py3-none-any.whl
Size 23.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f61f9d1e572efb314de3a6740e534263ddf6bee30a754177be79bda35033965
BLAKE2b-256 checksum
How to use checksums
dc01e6051c831d350010483faeec63ad7389e5b7ea22a52e8d32e2d955851d5f
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 Nov 1, 2026.

Transparency log

Security for pacificdb 1.2.0rc2

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pacificdb-1.2.0rc2.tar.gz

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 Nov 1, 2026.

Transparency log

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