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
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.

No database driver is declared. Add asyncpg for PostgreSQL or aiosqlite for SQLite.

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.4

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.4
File Size Uploaded Provenance Actions
rn_forge_sqlalchemy-0.2.4.tar.gz 12.5 kB With provenance Details for rn_forge_sqlalchemy-0.2.4.tar.gz

Built distribution (wheel)

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

Total release size: 27.2 kB

Release files / rn_forge_sqlalchemy-0.2.4.tar.gz

Download URL rn_forge_sqlalchemy-0.2.4.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a6e3971e9bdc35aa0b70fcc40c078ffb81a1de101bc01f9c13bab2fb4c592530
BLAKE2b-256 checksum
How to use checksums
ebf6ed9fb81ce2cf8d1ae76480bbcc7e17aff5fb1f1d88b50c08c9495dd83d30
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 18, 2026.

Transparency log

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

Download URL rn_forge_sqlalchemy-0.2.4-py3-none-any.whl
Size 14.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b26ff052d98ea4b8b15833f4ac5381e4b342b331fe9a781bc3ea24f8fbae88f
BLAKE2b-256 checksum
How to use checksums
46080b123cdc670c21a6832f0e08ba636e8defeb5970aa60bcf9a7691d3b702b
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 18, 2026.

Transparency log

Security for rn-forge-sqlalchemy 0.2.4

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.4.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 18, 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