xlambda-postgres
Managed PostgreSQL: provisioning, sub-users, backups, and a get_pool()
convenience.
pip install xlambda-postgres # provisioning only
pip install "xlambda-postgres[pool]" # plus psycopg, for get_pool()
Python port of @xlambda-tech/postgres.
Provisioning
from xlambda.postgres import PostgresClient
client = PostgresClient(api_key=os.environ["XLAMBDA_API_KEY"])
db = client.databases.create(project_id="proj_123", name="app", tier="starter")
db["connectionString"] # shown here and on rotate/reveal only
create(), rotate_password(), and reveal_connection() return a
DatabaseHandle — a plain dict subclass, so every response field reads
normally, with pool constructors added on top:
pool = db.get_pool() # port 6432, PgBouncer transaction pooling
migrations = db.get_session_pool() # port 6433, direct session
async_pool = db.get_async_pool() # psycopg_pool.AsyncConnectionPool
Which port matters. 6432 is transaction-pooled and is what steady-state
app traffic should use; its connection string carries ?pgbouncer=true,
which disables client-side prepared statements because transaction pooling
breaks them. Use 6433 for migrations, DDL, advisory locks, and anything else
needing a real session.
reveal_connection() discloses the current password rather than changing
it. It 404s for instances that predate the feature or were created without
CONSOLE_CREDENTIAL_ENCRYPTION_KEY configured — rotate to recover in that
case.
Sub-users and backups
user = client.databases.users(db["id"]).create(permission="readonly", expires_at="2027-01-01T00:00:00Z")
user["password"] # shown once
backups = client.databases.backups(db["id"])
backups.create()
backups.restore("bkp_123") # overwrites all current data; cannot be undone
What this doesn't wrap
The dashboard's own SQL console. Running queries isn't something the REST API
mediates — there's no app-facing /v1/databases/:id/query route — so once a
database is provisioned you talk to it with psycopg through the handle above.
get_pool() is a thin ergonomic wrapper around psycopg_pool, not a
reimplementation of it, and psycopg stays an optional extra so provisioning-only
callers don't install a driver they never use.
Async
from xlambda.postgres import AsyncPostgresClient
async with AsyncPostgresClient(api_key=...) as client:
db = await client.databases.create(project_id="proj_123", name="app")
Conventions
Arguments are snake_case; responses are the API's own camelCase, returned as
plain dicts typed by TypedDict. Byte counts that are bigints server-side
(storageQuotaBytes, storageBytes, backup sizeBytes) arrive as strings
rather than losing precision in JSON. See
xlambda-core.
Metadata
Release files for xlambda-postgres 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| xlambda_postgres-0.2.0.tar.gz | 7.6 kB | With provenance | Details for xlambda_postgres-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xlambda_postgres-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for xlambda_postgres-0.2.0-py3-none-any.whl |
Total release size: 16.8 kB
Release files / xlambda_postgres-0.2.0.tar.gz
| Download URL | xlambda_postgres-0.2.0.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
39729f5f9cb0debc4548edc2d1e4d1f952cf0d54138f595d69cc339552408faf
|
|
BLAKE2b-256 checksum How to use checksums |
eec23c5f1492e61de79edf82389d76349f611a255d60d6f878a64f7e681cc054
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 6, 2026.
Transparency logRelease files / xlambda_postgres-0.2.0-py3-none-any.whl
| Download URL | xlambda_postgres-0.2.0-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cd3095830e9d4c6fe2b77b346379ce52929687f804e01ece65817532a09c3063
|
|
BLAKE2b-256 checksum How to use checksums |
fd872cb7c2511c4db4d5048ee8e0848c53434ad8eec13c73d249e55ba6b0df8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 6, 2026.
Transparency logSecurity for xlambda-postgres 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for xlambda_postgres-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 6, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.