actiongate-postgres
Shared PostgreSQL store adapter for ActionGate, BudgetGate, RuleGate, and AuditGate.
Uses psycopg (psycopg3) with connection pooling. One pool shared across all gate stores.
Install
pip install actiongate-postgres
# Install with specific gate support:
pip install actiongate-postgres[actiongate]
pip install actiongate-postgres[all] # all four gates
Quickstart
import psycopg
from actiongate import Engine, Gate, Policy
from actiongate_postgres import ConnectionManager, ActionGatePostgresStore, create_tables
# Create shared pool
mgr = ConnectionManager("postgresql://localhost/mydb")
# Create tables (idempotent)
with mgr.pool.connection() as conn:
create_tables(conn)
# Wire store to engine
store = ActionGatePostgresStore(mgr)
engine = Engine(store=store)
engine.register(Gate("api", "send_email", "user-42"), Policy(max_calls=5, window=60))
result = engine.check(Gate("api", "send_email", "user-42"))
print(result) # Decision(status=ALLOW, ...)
mgr.close()
Async
from actiongate_postgres import AsyncConnectionManager, AsyncActionGatePostgresStore
async with AsyncConnectionManager("postgresql://localhost/mydb") as mgr:
store = AsyncActionGatePostgresStore(mgr)
# use with async engine...
Multiple Gates, One Pool
from actiongate_postgres import (
ConnectionManager,
ActionGatePostgresStore,
BudgetGatePostgresStore,
AuditGatePostgresStore,
create_tables,
)
mgr = ConnectionManager("postgresql://localhost/mydb")
with mgr.pool.connection() as conn:
create_tables(conn)
ag_store = ActionGatePostgresStore(mgr)
bg_store = BudgetGatePostgresStore(mgr)
audit_store = AuditGatePostgresStore(mgr)
Testing
# Start PostgreSQL
docker compose up -d
# Run tests
DATABASE_URL="postgresql://actiongate:actiongate@localhost/actiongate_test" pytest tests/ -v
License
Apache-2.0
Metadata
Release files for actiongate-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 | Provenance | Actions |
|---|---|---|---|---|
| actiongate_postgres-0.1.0.tar.gz | 15.9 kB | Without provenance | Details for actiongate_postgres-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| actiongate_postgres-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for actiongate_postgres-0.1.0-py3-none-any.whl |
Total release size: 31.0 kB
Release files / actiongate_postgres-0.1.0.tar.gz
| Download URL | actiongate_postgres-0.1.0.tar.gz |
|---|---|
| Size | 15.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6dddbbbc7d45a22a9b5202d510dda5b6a248d4668dc8cf0995e96af25c60e39c
|
|
BLAKE2b-256 checksum How to use checksums |
df6edfb72d0e887f275936c62108e266ac2523784992d39b1b904e9ea7dd3ae4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / actiongate_postgres-0.1.0-py3-none-any.whl
| Download URL | actiongate_postgres-0.1.0-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8b186ecfb5fdf9971bce238d888eb047e01aa1496085556c09f51b1f0f222071
|
|
BLAKE2b-256 checksum How to use checksums |
20bf9442922698464c8b838bff352da944f28d26927b4121a6318ae60dbe7b26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Security for actiongate-postgres 0.1.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.