nl2data-workflow-postgres
Optional PostgreSQL-backed durable workflow state backend for nl2data-core.
Overview
This package provides a production-ready PostgreSQL implementation of the core workflow state-store contracts (StateStore, IdempotencyStore, WorkflowLeaseStore, and FencedStateStore) from nl2data-core. It persists safe workflow snapshots, idempotency records, and execution leases in PostgreSQL while keeping psycopg lazy and optional.
Base nl2data / nl2data-core imports remain PostgreSQL-free; the driver is loaded only when a PostgreSQLStateStore is constructed.
Installation
pip install nl2data-workflow-postgres
This also installs psycopg[binary,pool]>=3.1,<4 and nl2data-core>=0.1.0.
Quick Start
from nl2data_core.workflow import WorkflowState
from nl2data_workflow_postgres import PostgreSQLStateStore, WorkflowPostgresConfig
store = PostgreSQLStateStore(
dsn="postgresql://user:pass@localhost/db",
config=WorkflowPostgresConfig(namespace="workflow"),
)
# store.create(state), store.update(...), store.acquire_lease(...), etc.
Public surface
from nl2data_workflow_postgres import (
MIGRATIONS,
SUPPORTED_SCHEMA_VERSION,
SQL_TEMPLATES,
PostgreSQLStateStore,
WorkflowPostgresConfig,
build_pool,
driver_available,
)
PostgreSQLStateStore— the core store-contract implementation (StateStore,IdempotencyStore,WorkflowLeaseStore,FencedStateStore) with compare-and-set updates and fenced lease checks.WorkflowPostgresConfig— bounded pool/timeout/TTL configuration with a derived tenant-scope namespace.MIGRATIONS/SUPPORTED_SCHEMA_VERSION— versioned DDL in a package-owned schema namespace.build_pool/driver_available— lazy psycopg pool construction and driver availability probes that never import the driver.
Compatibility
The in-core nl2data_core.workflow.postgres_* modules were removed. All
PostgreSQL workflow state ships from this package; import from
nl2data_workflow_postgres directly. The core distribution no longer ships a
PostgreSQL workflow backend.
Features
- Durable workflow state with versioned safe snapshots and compare-and-set semantics
- Idempotency records with reservation, conflict detection, and terminal outcome references
- Lease ownership with monotonic fencing tokens, renewal, release, and stale-worker takeover
- Tenant-scope isolation via opaque fingerprints and derived schema namespaces
- Versioned migrations in a package-owned schema namespace
- Normalized errors without leaking DSNs, credentials, or raw backend text
- Lazy driver loading so the base framework never imports
psycopg
Development
Install in editable mode from the repository root:
pip install -e packages/nl2data-workflow-postgres
Run package tests:
pytest packages/nl2data-workflow-postgres/tests -q
Metadata
Release files for nl2data-workflow-postgres 0.1.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 | |
|---|---|---|---|
| nl2data_workflow_postgres-0.1.0.tar.gz | 32.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nl2data_workflow_postgres-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 55.4 kB
Release files / nl2data_workflow_postgres-0.1.0.tar.gz
| Download URL | nl2data_workflow_postgres-0.1.0.tar.gz |
|---|---|
| Size | 32.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bb6ddf91380d9ee75d2a5986c8ee61a3ca1e00b2360b05e33e2ab9d926af4f64
|
|
BLAKE2b-256 checksum How to use checksums |
8eb571b438761919425f75cbb35f1ce64bff865d160b849ef8f149398f4a7324
|
| 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 Oct 13, 2026.
Transparency logRelease files / nl2data_workflow_postgres-0.1.0-py3-none-any.whl
| Download URL | nl2data_workflow_postgres-0.1.0-py3-none-any.whl |
|---|---|
| Size | 22.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
53acea144d8f5e890f6911b7271472c7f38eca64799417c9dd2f544d1ee3dd92
|
|
BLAKE2b-256 checksum How to use checksums |
abb99110c9f783dcae04d731401bfd6621ced74385f5690ca8fcf4b73f94a533
|
| 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 Oct 13, 2026.
Transparency log