Skip to main content

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)

Source distribution for pmdb_utils 0.5.61
File Size Uploaded
pmdb_utils-0.5.61.tar.gz 82.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pmdb_utils 0.5.61
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.5.61 This release

2 release files

0.5.59

2 release files

0.5.58

2 release files

0.5.51

2 release files

0.5.50

2 release files

0.5.49

2 release files

0.5.47

2 release files

0.5.44

2 release files

0.4.46

2 release files

0.4.44

2 release files

0.3.44

2 release files

0.3.43

2 release files

0.3.42

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page