nl2data-workflow-postgres 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nl2data_workflow_postgres/__init__.py +25 -0
- nl2data_workflow_postgres/client.py +138 -0
- nl2data_workflow_postgres/config.py +83 -0
- nl2data_workflow_postgres/fake_postgres.py +834 -0
- nl2data_workflow_postgres/py.typed +0 -0
- nl2data_workflow_postgres/schema.py +90 -0
- nl2data_workflow_postgres/store.py +1166 -0
- nl2data_workflow_postgres-0.1.0.dist-info/METADATA +110 -0
- nl2data_workflow_postgres-0.1.0.dist-info/RECORD +11 -0
- nl2data_workflow_postgres-0.1.0.dist-info/WHEEL +5 -0
- nl2data_workflow_postgres-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nl2data-workflow-postgres
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: PostgreSQL-backed durable workflow state backend for nl2data-core.
|
|
5
|
+
Author: NL2Data Contributors
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Keywords: nl2data,postgresql,workflow,state,lease,idempotency
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
Requires-Dist: nl2data-core>=0.1.0
|
|
18
|
+
Requires-Dist: psycopg[binary,pool]<4,>=3.1
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
21
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
|
|
22
|
+
Requires-Dist: mypy>=1.10; extra == "dev"
|
|
23
|
+
Requires-Dist: ruff>=0.5; extra == "dev"
|
|
24
|
+
|
|
25
|
+
# nl2data-workflow-postgres
|
|
26
|
+
|
|
27
|
+
Optional PostgreSQL-backed durable workflow state backend for `nl2data-core`.
|
|
28
|
+
|
|
29
|
+
## Overview
|
|
30
|
+
|
|
31
|
+
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.
|
|
32
|
+
|
|
33
|
+
Base `nl2data` / `nl2data-core` imports remain PostgreSQL-free; the driver is loaded only when a `PostgreSQLStateStore` is constructed.
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install nl2data-workflow-postgres
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
This also installs `psycopg[binary,pool]>=3.1,<4` and `nl2data-core>=0.1.0`.
|
|
42
|
+
|
|
43
|
+
## Quick Start
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from nl2data_core.workflow import WorkflowState
|
|
47
|
+
from nl2data_workflow_postgres import PostgreSQLStateStore, WorkflowPostgresConfig
|
|
48
|
+
|
|
49
|
+
store = PostgreSQLStateStore(
|
|
50
|
+
dsn="postgresql://user:pass@localhost/db",
|
|
51
|
+
config=WorkflowPostgresConfig(namespace="workflow"),
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
# store.create(state), store.update(...), store.acquire_lease(...), etc.
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Public surface
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
from nl2data_workflow_postgres import (
|
|
61
|
+
MIGRATIONS,
|
|
62
|
+
SUPPORTED_SCHEMA_VERSION,
|
|
63
|
+
SQL_TEMPLATES,
|
|
64
|
+
PostgreSQLStateStore,
|
|
65
|
+
WorkflowPostgresConfig,
|
|
66
|
+
build_pool,
|
|
67
|
+
driver_available,
|
|
68
|
+
)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
- `PostgreSQLStateStore` — the core store-contract implementation
|
|
72
|
+
(`StateStore`, `IdempotencyStore`, `WorkflowLeaseStore`, `FencedStateStore`)
|
|
73
|
+
with compare-and-set updates and fenced lease checks.
|
|
74
|
+
- `WorkflowPostgresConfig` — bounded pool/timeout/TTL configuration with a
|
|
75
|
+
derived tenant-scope namespace.
|
|
76
|
+
- `MIGRATIONS` / `SUPPORTED_SCHEMA_VERSION` — versioned DDL in a package-owned
|
|
77
|
+
schema namespace.
|
|
78
|
+
- `build_pool` / `driver_available` — lazy psycopg pool construction and
|
|
79
|
+
driver availability probes that never import the driver.
|
|
80
|
+
|
|
81
|
+
## Compatibility
|
|
82
|
+
|
|
83
|
+
The in-core `nl2data_core.workflow.postgres_*` modules were removed. All
|
|
84
|
+
PostgreSQL workflow state ships from this package; import from
|
|
85
|
+
`nl2data_workflow_postgres` directly. The core distribution no longer ships a
|
|
86
|
+
PostgreSQL workflow backend.
|
|
87
|
+
|
|
88
|
+
## Features
|
|
89
|
+
|
|
90
|
+
- **Durable workflow state** with versioned safe snapshots and compare-and-set semantics
|
|
91
|
+
- **Idempotency records** with reservation, conflict detection, and terminal outcome references
|
|
92
|
+
- **Lease ownership** with monotonic fencing tokens, renewal, release, and stale-worker takeover
|
|
93
|
+
- **Tenant-scope isolation** via opaque fingerprints and derived schema namespaces
|
|
94
|
+
- **Versioned migrations** in a package-owned schema namespace
|
|
95
|
+
- **Normalized errors** without leaking DSNs, credentials, or raw backend text
|
|
96
|
+
- **Lazy driver loading** so the base framework never imports `psycopg`
|
|
97
|
+
|
|
98
|
+
## Development
|
|
99
|
+
|
|
100
|
+
Install in editable mode from the repository root:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
pip install -e packages/nl2data-workflow-postgres
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Run package tests:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
pytest packages/nl2data-workflow-postgres/tests -q
|
|
110
|
+
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
nl2data_workflow_postgres/__init__.py,sha256=41p63rJ4WSpykJlY68yVWpVoPvAT13flmn7WTbjwddg,762
|
|
2
|
+
nl2data_workflow_postgres/client.py,sha256=0cLwju30wwbgVOYJTyS8apEU3d_1PYB8C05OegPfHlc,5001
|
|
3
|
+
nl2data_workflow_postgres/config.py,sha256=FLkkIuzpILEjsi0D0_hAR358tR2W2x6QsBmxDeCfyno,3769
|
|
4
|
+
nl2data_workflow_postgres/fake_postgres.py,sha256=8jRkkCn6jvhFlclA8LR4tmdibenxWEgZb3n0vYI7hcs,29847
|
|
5
|
+
nl2data_workflow_postgres/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
nl2data_workflow_postgres/schema.py,sha256=SFHARqBCjej4mrPpObJP8h7sbLlhGIu_Hgse-6RcJss,3568
|
|
7
|
+
nl2data_workflow_postgres/store.py,sha256=zcWkTcX-GZP2XnRp9qy5jZzfozkzLalE9rp0zBu8Sg8,49031
|
|
8
|
+
nl2data_workflow_postgres-0.1.0.dist-info/METADATA,sha256=0kIIFbwtr5xnAeGzxjMVHs_VSutGpGzcQc7Meuw__ww,3920
|
|
9
|
+
nl2data_workflow_postgres-0.1.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
10
|
+
nl2data_workflow_postgres-0.1.0.dist-info/top_level.txt,sha256=JcvlwKrGnNLypZr-gTMTnGfEnECVBlCouqiAF-fM2TU,26
|
|
11
|
+
nl2data_workflow_postgres-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
nl2data_workflow_postgres
|