Skip to main content

Python gRPC client for the Xeze Database Router (PostgreSQL, MongoDB, Redis over mTLS)

Project description

xeze-dbr

Python gRPC client for the Xeze Database Router — a unified interface for PostgreSQL, MongoDB, and Redis over mTLS.

Install

pip install xeze-dbr

Quick Start

from xeze_dbr import connect

# Connect with mTLS (production)
client = connect(
    host="db.0.xeze.org:443",
    cert_path="client.crt",
    key_path="client.key",
)

# Health check
health = client.health.Check(client.pb2.HealthCheckRequest())
print(health.overall_healthy)  # True

# PostgreSQL — list databases
dbs = client.postgres.ListDatabases(client.pb2.ListDatabasesRequest())
print(dbs.databases)

# PostgreSQL — insert data
from google.protobuf import struct_pb2
resp = client.postgres.InsertData(client.pb2.InsertDataRequest(
    database="mydb",
    table="users",
    data={
        "name": struct_pb2.Value(string_value="Alice"),
        "age": struct_pb2.Value(number_value=28),
    }
))
print(resp.inserted_id)

# MongoDB — insert document
doc = struct_pb2.Struct()
doc.update({"event": "signup", "user": "Alice"})
resp = client.mongo.InsertDocument(client.pb2.InsertDocumentRequest(
    database="mydb",
    collection="events",
    document=doc,
))
print(resp.inserted_id)

# Redis — set & get
client.redis.SetValue(client.pb2.SetValueRequest(
    key="session:abc", value="user:42", ttl=3600
))
val = client.redis.GetValue(client.pb2.GetValueRequest(key="session:abc"))
print(val.value)

# Clean up
client.close()

Vault / Secret Manager Integration (No Files)

If you use HashiCorp Vault, AWS Secrets Manager, or Doppler, you can pass raw certificate bytes instead of file paths using cert_data and key_data parameters:

import hvac
from xeze_dbr import connect

# 1. Get raw bytes from Vault
vault = hvac.Client(url="http://127.0.0.1:8200", token="dev-root-token")
secret = vault.secrets.kv.v2.read_secret_version(path="dbrouter/certs")

# 2. Connect directly (no files on disk!)
client = connect(
    host="db.0.xeze.org:443",
    cert_data=secret["data"]["data"]["client_cert"].encode(),
    key_data=secret["data"]["data"]["client_key"].encode(),
)

Local Development (no TLS)

client = connect(host="localhost:50051", insecure=True)

Available Services

Stub Methods
client.health Check, CheckPostgres, CheckMongo, CheckRedis
client.postgres ListDatabases, CreateDatabase, ListTables, ExecuteQuery, SelectData, InsertData, UpdateData, DeleteData
client.mongo ListDatabases, ListCollections, InsertDocument, FindDocuments, UpdateDocument, DeleteDocument
client.redis ListKeys, SetValue, GetValue, DeleteKey, Info

License

Apache 2.0

Project details


Download files

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

Source Distribution

xeze_dbr-0.2.2.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

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

xeze_dbr-0.2.2-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file xeze_dbr-0.2.2.tar.gz.

File metadata

  • Download URL: xeze_dbr-0.2.2.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xeze_dbr-0.2.2.tar.gz
Algorithm Hash digest
SHA256 efd7332c6c2cf484d7e7656582a04424d6c701c6a0a20834f266ac20b4e9a3c9
MD5 fb71077e2a1ad891d358d1b48cc22ea6
BLAKE2b-256 9c4b06fc31d5a9d47ef140ddf45b2303882cb46d67a6ff51e2205cb2c8c78db5

See more details on using hashes here.

Provenance

The following attestation bundles were made for xeze_dbr-0.2.2.tar.gz:

Publisher: pypi-publish.yml on Xeze-org/Database-Router

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

File details

Details for the file xeze_dbr-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: xeze_dbr-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xeze_dbr-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 14b92295e743f745eb9cff23e502db6847fc52f2f9fee3150dc21ac9485386a7
MD5 73da1c6ca08df96c94cc63f068e7331e
BLAKE2b-256 30e884140a937374333f3669765b8e57987e729d0ccabbf3d4c450251967f31a

See more details on using hashes here.

Provenance

The following attestation bundles were made for xeze_dbr-0.2.2-py3-none-any.whl:

Publisher: pypi-publish.yml on Xeze-org/Database-Router

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