pmdb_utils
Shared utilities for the Poorman Data Platform.
PostgreSQL writes
PostgresDB reads the application connection from DATABASE_URL by default.
Select DATABASE_URL_LOG explicitly when writing to the separate log database.
from pmdb_utils.dataacceslayer import PostgresDB
with PostgresDB.from_env("DATABASE_URL_LOG") as db:
db.create_table(
"public.worker_log",
{
"id": "BIGSERIAL PRIMARY KEY",
"job_id": "TEXT NOT NULL",
"status": "TEXT NOT NULL",
"details": "JSONB",
},
)
db.insert(
"public.worker_log",
{"job_id": "job-123", "status": "started", "details": {}},
)
changed = db.update(
"public.worker_log",
values={"status": "complete"},
where={"job_id": "job-123"},
)
deleted = db.delete(
"public.worker_log",
where={"job_id": "job-123"},
)
The update and delete methods require at least one equality condition and
return the affected row count. Values are parameterized, table and column names
are quoted, and dictionaries/lists are adapted for PostgreSQL JSON columns.
Use bulk_insert for multiple rows and execute or transaction for complex
SQL.
Metadata
Release files for pmdb_utils 0.5.61
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pmdb_utils-0.5.61.tar.gz | 82.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pmdb_utils-0.5.61-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 102.6 kB
Release files / pmdb_utils-0.5.61.tar.gz
| Download URL | pmdb_utils-0.5.61.tar.gz |
|---|---|
| Size | 82.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b9ae2f174869cdfad7bb6da5c6c929d81f04ce502c88494a612bf328568746e
|
|
BLAKE2b-256 checksum How to use checksums |
c1654abf5460a58430d4701905daa74265cce483882324f030edd82a8e0292e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.4
|
Release files / pmdb_utils-0.5.61-py3-none-any.whl
| Download URL | pmdb_utils-0.5.61-py3-none-any.whl |
|---|---|
| Size | 20.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cac01bb15beec37ce400ed23dd1f1fc64972c98a9543787e6bc1a03430812409
|
|
BLAKE2b-256 checksum How to use checksums |
a897c1ea039fdeb5a4b6200aa14791d5321d271e8f64c63d2d7debca5f353641
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.4
|