Skip to main content

rn-forge-sqlalchemy

Documentation · Changelog · Source · All pykit packages

Async SQLAlchemy building blocks that match the rn-forge-web wire: audit and version columns, a bulk upsert for imports, and keyset pagination over web's opaque page token.

Module What it holds
models Base (Alembic naming convention), UTCDateTime, AuditMixin (create_time, update_time, created_by, updated_by), VersionMixin, SoftDeleteMixin, live, soft_delete, undelete
concurrency update_versioned — optimistic concurrency, raising rn_forge.web.VersionConflict (412)
upsert upsert — create or update rows by natural key, counting created, updated and skipped
postgres create_postgres_engine — an async PostgreSQL engine (asyncpg) with UTC sessions, pool settings and an optional statement timeout and application name
testing postgres_schema — a pytest plugin whose fixture gives each test its own PostgreSQL schema; needs the testing and postgres extras and is loaded with pytest_plugins, not imported from the facade
sqlite create_sqlite_engine — an async SQLite engine with WAL, foreign keys, busy timeout and synchronous set on every connection
migrate run_migrations — Alembic upgrade from inside the process; needs the migrations extra and is imported directly, not from the facade
pagination keyset, next_page_token — AIP-132 orderBy and AIP-158 tokens over a Select

Everything works on PostgreSQL and SQLite, through AsyncSession only.

Where it sits

It depends on rn-forge-web and SQLAlchemy and imports no web framework or framework package; task lint proves it. An application wires it to its framework itself: the FastAPI guide shows the import and list endpoints.

Installation

Require the packages by version range:

dependencies = [
  "rn-forge-sqlalchemy>=0.2,<0.3",
  "rn-forge-web>=0.3,<0.4",
]

Application code catches rn_forge.web.VersionConflict and passes rn_forge.web pagination terms, so declare rn-forge-web as well.

The core install carries no database driver. rn-forge-sqlalchemy[postgres]>=0.2.5,<0.3 installs asyncpg and rn-forge-sqlalchemy[sqlite]>=0.2.5,<0.3 installs aiosqlite.

run_migrations needs the migrations extra: rn-forge-sqlalchemy[migrations]>=0.2.3,<0.3.

Minimum example

from sqlalchemy.orm import Mapped, mapped_column
from rn_forge.sqlalchemy import AuditMixin, Base, VersionMixin


class Order(AuditMixin, VersionMixin, Base):
    __tablename__ = "order"

    id: Mapped[str] = mapped_column(primary_key=True)
    name: Mapped[str] = mapped_column(unique=True)

Errors

update_versioned raises rn_forge.web.VersionConflict (412) when the row is at another version and LookupError when it is gone. upsert raises ValueError for an empty key, a row missing a column or a duplicate key, TypeError for a model without AuditMixin, and NotImplementedError for a dialect other than PostgreSQL or SQLite.

Testing

The default test run uses SQLite. Tests marked postgres run when RN_FORGE_TEST_POSTGRES_DSN is set; task ci:integration -- rn-forge-sqlalchemy starts PostgreSQL and sets it.

Not included

The SQL idempotency store, session and unit-of-work helpers, readiness checks and multi-tenant scoping wait for an application that needs them.

Metadata

Release files for rn-forge-sqlalchemy 0.2.5

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

Source distribution (sdist)

Source distribution for rn-forge-sqlalchemy 0.2.5
File Size Uploaded Provenance Actions
rn_forge_sqlalchemy-0.2.5.tar.gz 16.1 kB With provenance Details for rn_forge_sqlalchemy-0.2.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rn-forge-sqlalchemy 0.2.5
File Interpreter ABI Platform Actions
rn_forge_sqlalchemy-0.2.5-py3-none-any.whl Python 3 none any Details for rn_forge_sqlalchemy-0.2.5-py3-none-any.whl

Total release size: 35.3 kB

Release files / rn_forge_sqlalchemy-0.2.5.tar.gz

Download URL rn_forge_sqlalchemy-0.2.5.tar.gz
Size 16.1 kB
Tags Source
SHA-256 checksum
How to use checksums
98b5741ebcbf32a75732d53079c48b483eb14e16334b1817dfd83b51bb708d8a
BLAKE2b-256 checksum
How to use checksums
024a9adce814dd38b2a05dea23184f882d95b59fb9081521c49423dd89d71b53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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 24, 2026.

Transparency log

Release files / rn_forge_sqlalchemy-0.2.5-py3-none-any.whl

Download URL rn_forge_sqlalchemy-0.2.5-py3-none-any.whl
Size 19.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a129e2329ee6b0555ebadc923af03d73405e45078cc2c7bb401bfa0372cacde9
BLAKE2b-256 checksum
How to use checksums
3abad9408d2d06fbfc07215b7b173e7d8090adfdaf4d593ecff9bb11baa3a2b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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 24, 2026.

Transparency log

Security for rn-forge-sqlalchemy 0.2.5

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 rn_forge_sqlalchemy-0.2.5.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 24, 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.

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