Skip to main content

pgsqlite-failover

SQLAlchemy middleware: PostgreSQL primary, durable SQLite fallback, transaction journal and replay.

from sqlalchemy import text
from pgsqlite_failover import create_failover_engine

engine = create_failover_engine("postgresql+psycopg://user:pass@localhost/app", project_root=".")
with engine.begin() as conn:
    conn.execute(text("INSERT INTO events (name) VALUES (:name)"), {"name": "Tin360"})

Storage defaults to <project_root>/.pgsqlite-failover/ (fallback.db, backup.db, journal.db, logs/); override with storage_dir= or PGSQLITE_FAILOVER_DIR. Add the directory to .gitignore.

Status (0.2.0)

SQLAlchemy Core only. Routing is per transaction; writes on the fallback are journaled and replayed in order when the primary recovers. Known limits: the fallback schema must be provisioned separately, SQL must be portable between PostgreSQL and SQLite, replay is at-least-once (make writes idempotent), ORM Session, multi-process coordination and PG→SQLite bootstrap are on the roadmap (0.3–0.5).

Testing

pip install -e ".[postgres,test]"
pytest            # integration tests start PostgreSQL with testcontainers (needs Docker)

Without Docker, point the suite at an existing server: PGSQLITE_TEST_POSTGRES_URL=postgresql+psycopg://user:pw@host:5432/db pytest (the tests create and drop an events table). Outages are simulated with a local TCP proxy.

Metadata

Release files for pgsqlite-failover 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pgsqlite-failover 0.2.0
File Size Uploaded Provenance Actions
pgsqlite_failover-0.2.0.tar.gz 10.8 kB With provenance Details for pgsqlite_failover-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pgsqlite-failover 0.2.0
File Interpreter ABI Platform Actions
pgsqlite_failover-0.2.0-py3-none-any.whl Python 3 none any Details for pgsqlite_failover-0.2.0-py3-none-any.whl

Total release size: 20.2 kB

Release files / pgsqlite_failover-0.2.0.tar.gz

Download URL pgsqlite_failover-0.2.0.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0f59338f875f3fe1c2c155046b9b9e574f22fa18126a13655918fa9367a66cd9
BLAKE2b-256 checksum
How to use checksums
e96a6762c321076234f31f96b4b201676d3c40dde10be8f8b90a1b5562041e1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 13, 2026.

Transparency log

Release files / pgsqlite_failover-0.2.0-py3-none-any.whl

Download URL pgsqlite_failover-0.2.0-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc6165160c42ff6a261e2d0b042aa4f34c3da85bfc1e7d2d0e44eaabae053679
BLAKE2b-256 checksum
How to use checksums
485dd65861488501bc4b65e578b5a763ddc07cd04666ae80bd26b6074a8f17f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 13, 2026.

Transparency log

Security for pgsqlite-failover 0.2.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pgsqlite_failover-0.2.0.tar.gz

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 Nov 13, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

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