Skip to main content

Python client for ValtheraDB Conduit.

Project description

wxn0brp-db-conduit

Python bridge for ValtheraDB Conduit.

Install the package:

pip install wxn0brp-db-conduit

Import the package from the wxn0brp.db namespace:

from wxn0brp.db import conduit

Quick Start

Create a controller, initialize a DB, then work with collections:

from wxn0brp.db import conduit

controller = conduit.ValtheraConduit("./vendor/vdb", auto_download=True)

db = controller.data.init("./data")
users = db.c("users")

users.add({"name": "Ada"})
print(users.find({"name": "Ada"}))

controller.shutdown()

Use a context manager when you want the conduit process to shut down automatically:

from wxn0brp.db import conduit

with conduit.ValtheraConduit("./vendor/vdb", auto_download=True) as controller:
    db = controller.data.init("./data")
    users = db.c("users")

    users.add({"name": "Ada"})
    print(users.find({"name": "Ada"}))

Controller and DB Initialization

ValtheraConduit controls the conduit binary process. A DB must be initialized before it can execute operations.

Attribute style:

db = controller.data.init("./data", opts={"numberId": False})

Explicit style:

db = controller.init("data", "./data", opts={"numberId": False})

API Shape

Attribute-style DB initialization names the DB from the attribute:

db = controller.data.init("./data")

The explicit equivalent is:

db = controller.init("data", "./data")

opts is optional and defaults to {}:

db = controller.data.init("./data", opts={"numberId": False})

Collections are available through db.c(name), db.collection(name), or attribute access:

users = db.c("users")
users = db.collection("users")
users = db.users

Both Pythonic snake_case and Valthera-style camelCase aliases are available for methods such as find_one/findOne, update_one/updateOne, and update_one_or_add/updateOneOrAdd.

For explicit binary installation, run:

python -m wxn0brp.db.conduit.install --install-dir ./vendor/vdb

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wxn0brp_db_conduit-0.0.2-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file wxn0brp_db_conduit-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for wxn0brp_db_conduit-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e32619da8559b645b59631c6b13db5cf4e773eef0ddce2f1eb861b4bcddde6e9
MD5 8fae290d3a0a83c521537f8414d26c7e
BLAKE2b-256 825a697fcf66b5c9578b2a1cca4b2590ea5b75f2e6101df4ad0526b90b18e22a

See more details on using hashes here.

Provenance

The following attestation bundles were made for wxn0brp_db_conduit-0.0.2-py3-none-any.whl:

Publisher: python-bridge.yml on wxn0brP/ValtheraDB-conduit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page