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()

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

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 Distribution

xeze_dbr-0.2.0.tar.gz (11.2 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.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xeze_dbr-0.2.0.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for xeze_dbr-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b684d4f78f95e2e6e1ba89f5732067097098f7068c49fa1d6887553facea3ca4
MD5 05b05664d6fcb837bb78f72ce38a266f
BLAKE2b-256 0a6f6f633977e1f1a2c01fbe2dee3c853ef9240e367bbd9042f2eadf4b64606f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xeze_dbr-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for xeze_dbr-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aab4829ec74d950e6709fd14a39307eaac92a2ade23dab309a92edb0fad3e0c2
MD5 cd5cde6cea4821b70e9c659ca0aab70b
BLAKE2b-256 b82c6462b41e50cbe10904ad2a5da4f6d1f250301c7f28bda5e0368de8a958f0

See more details on using hashes here.

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