Start here

RowGuard turns SQLAlchemy query results into validated Pydantic models.

Day-1 path: InstallQuickstart → skim SQLRules pushdown.

By default, SQLRules pushes supported constraints into SQL. Every row that reaches validation is accepted or explicitly rejected—never ignored after fetch. Use use_sqlrules=False when you need invalid rows classified in Python.

Choose a path

You want to…

Go to

Install and run a first query

InstallationQuickstart

Understand why rejected can be empty

SQLRules pushdown

Upgrade from a prior minor

Upgrading

Rejection policies

Rejection policies

Stream large results

Streaming

AsyncSession

Async

Performance tips

Performance

What is shipped vs planned

Supported vs planned

API contracts

API guide · Errors

What RowGuard is

  • Orchestration over SQLAlchemy + SQLRules + Pydantic

  • Sync and async buffered and streaming APIs

  • Policies: raise (default), collect, skip, log, callback, quarantine

What RowGuard is not

  • Not an ORM / persistence layer (it validates ORM and SQLModel reads)

  • Not a migration tool

  • Not a replacement for SQLAlchemy or Pydantic

  • Not an authorization system (pushdown is not a security boundary)

Requirements

  • Python 3.10+ (3.10–3.12 tested in CI; 3.13 untested)

  • Pydantic v2, SQLAlchemy 2.x, SQLRules ≥ 1.0

Optional: pip install "rowguard[async]" / "rowguard[sqlmodel]".

Next

  1. Install

  2. Quickstart — default path first, then inspect rejections

  3. FAQ / Troubleshooting