Skip to main content

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

Project description

xeze-dbr

🚀 Automatic Package Release on changes

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.3.tar.gz (14.6 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.3-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for xeze_dbr-0.2.3.tar.gz
Algorithm Hash digest
SHA256 bfd5b1cb6d6278b05bde4b9e69c3d96878a5c3d2c443e9f117a00e3b87ed82f6
MD5 bb776b80a4c5ebbf576fdd641398169a
BLAKE2b-256 cae261715e434f57d38b278cd17b2d0beb994911403e0251b2cae7e053bb03b5

See more details on using hashes here.

Provenance

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

Publisher: pypi-publish-sdk.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.3-py3-none-any.whl.

File metadata

  • Download URL: xeze_dbr-0.2.3-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.12

File hashes

Hashes for xeze_dbr-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 be744434bfc42f36eddb8f26e99f8c59ff2e4f0ca24f5246fbdbc1e5f04abe29
MD5 7ad371877e8e3105cfc6634c02e6a977
BLAKE2b-256 d0c232a885d9c6e6536c84f39a791f0c32e24d12be94d0d8f0e44b195c878e61

See more details on using hashes here.

Provenance

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

Publisher: pypi-publish-sdk.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