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.1.0.tar.gz (11.1 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.1.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xeze_dbr-0.1.0.tar.gz
  • Upload date:
  • Size: 11.1 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.1.0.tar.gz
Algorithm Hash digest
SHA256 84c38c033a7bdf41c196295c710dc8162df7000ea6d5f7ccedf3e02c89dc9255
MD5 e4a2da57f8b36c8d6709a9b30c4d9ab0
BLAKE2b-256 0593df6be0cb4812b8a284d6a50dc51b9c6123397517df94ba3af97040a3db7d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xeze_dbr-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b4d362edb5df94066573930f10eb5889f54d2170731ca634c10ea1dc4fce5f8
MD5 1d5a2a241685c2f499e040d633ea3654
BLAKE2b-256 5f74641e4643eb7549d3226c7b36722336070123732d273464a8bfbf9a07b628

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