udb 0.2.1

Universal Data Broker — a Rust gRPC broker over multiple databases (Postgres, MySQL, SQLite, MongoDB, ClickHouse, Cassandra, MSSQL, Redis, Qdrant, S3, Neo4j, …) with per-tenant RLS, 2PC, sagas, and CDC.
Documentation
# Python UDB SDK ACME Billing Example

Standalone Python project using `uv`, the published `udb-client` SDK, and an arbitrary `acme.billing.v1` proto package.

This example does not require a UDB source checkout. It uses:

- `uv` for Python dependency management
- `udb-client>=0.1.4` from PyPI
- generated Python protobuf models under `gen/`
- UDB CLI from a GitHub Release, or the UDB broker/CLI through local Docker Compose

## Project Files

| Path | Purpose |
|------|---------|
| `proto/` | The ACME Billing proto used by both UDB and Python model generation |
| `gen/` | Generated Python protobuf models |
| `db_ops/` | Generated by UDB CLI from `proto/`; committed so the example shows migration output |
| `docker-compose.yml` | Local Postgres, Redis, Qdrant, MinIO, and UDB broker |
| `scripts/` | Project commands that call UDB as an external CLI/image |
| `acme_billing.py` | Python SDK smoke client using generated `Product` |

## Generate

Generate project models and UDB migrations:

```powershell
.\scripts\generate.ps1 -Runner docker
```

Or use a GitHub Release CLI binary:

```powershell
$env:UDB_RUNNER = "release"
.\scripts\generate.ps1
```

`generate.ps1` uses `uv run --no-project --with grpcio-tools` for Python model generation, then asks UDB to generate `db_ops/` from `proto/`.

Before the first public UDB release exists, the default `releases/latest/download/...` URL will 404. For local pre-release testing, point the script at a binary you already built:

```powershell
cargo build --bin udb-proto-parser
$env:UDB_CLI = "E:\Projects\udb\target\debug\udb-proto-parser.exe"
.\scripts\generate.ps1 -Runner auto
```

## Start Broker

```powershell
.\scripts\serve.ps1
.\scripts\bootstrap.ps1 -Runner docker
```

The compose stack provides Postgres, Redis, Qdrant, MinIO, and the UDB broker.

## Run Client

After `udb-client` `0.1.4` is published:

```powershell
uv sync
$env:UDB_TARGET = "127.0.0.1:50051"
uv run python acme_billing.py
```

The client performs relational create/read/update/delete, vector upsert/search, and object put/get/presign checks against the local broker.

## Checks

```powershell
uv sync --extra dev
uv run pytest
uv run pyrefly check
```