Skip to main content

rowx

Typesafe raw SQL for Python 3.14+. No ORM: you write SQL as a PEP 750 t-string and say what a row looks like. A Rust driver built on tokio-postgres runs it, and rowx check validates every query against a live Postgres 18 database before you ship.

Quickstart

import asyncio

from rowx.postgres import Pool
from rowx import query

type UserRow = tuple[int, str, str | None]  # id, name, email


async def main() -> None:
    async with Pool(DSN, max_size=10) as pool:
        name = "alice"
        user = await query[UserRow](t"SELECT id, name, email FROM users WHERE name = {name}").one(pool)
        assert user[1] == "alice"

        names = await query[str](t"SELECT name FROM users ORDER BY name").all(pool)
        assert names == ["alice", "bob", "carol"]

        ids = [user[0]]
        updated = await query(t"UPDATE users SET email = {None} WHERE id = ANY({ids})").execute(pool)
        assert updated.rows_affected == 1


asyncio.run(main())
  • Pool is safe to create at module level and acquires a connection per call. Use rowx.postgres.connect(dsn) for a single connection, and pool.transaction() for transactions.
  • Interpolations ({name}) are always bound as server-side parameters. They are never pasted into the SQL text.
  • query[T] states the row type. one returns T, optional returns T | None, all returns list[T], and execute returns a QueryResult with rows_affected.
  • Type checkers (pyright, mypy, ty) infer all of this with no plugin.

Rows can also be a dataclass, NamedTuple, TypedDict or pydantic model, matched to the columns by name:

import asyncio
from dataclasses import dataclass

from rowx.postgres import connect
from rowx import query


@dataclass(slots=True)
class User:
    id: int
    name: str
    email: str | None


async def main() -> None:
    async with await connect(DSN) as conn:
        user = await query[User](t"SELECT id, name, email FROM users WHERE name = {'alice'}").one(conn)
        assert user.name == "alice"


asyncio.run(main())

Check the queries against your database:

rowx check src --database-url postgresql://app@localhost/app

rowx check exits 0 when every query matches the database, 1 when it reports diagnostics, and 2 on a usage or connection error.

Documentation

  • User guide: row types (tuples, scalars and named classes), pools, transactions, migrations, writing queries, overrides, the checker, CI and poolers.
  • Postgres type mapping: what each Postgres type decodes to and which Python types can be bound.
  • Known limits: where nullability inference is less precise than the database.
  • Design: the full specification.

Metadata

Release files for rowx 0.1.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 rowx 0.1.0
File Size Uploaded Provenance Actions
rowx-0.1.0.tar.gz 616.7 kB Without provenance Details for rowx-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rowx 0.1.0
File Interpreter ABI Platform Actions
rowx-0.1.0-cp314-abi3-macosx_11_0_arm64.whl CPython 3.14 abi3 macOS 11.0+ ARM64 Details for rowx-0.1.0-cp314-abi3-macosx_11_0_arm64.whl

Total release size: 4.1 MB

Release files / rowx-0.1.0.tar.gz

Download URL rowx-0.1.0.tar.gz
Size 616.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b108f172b72819178675a5d6ccb7103cfd5f062df1a82ec42dd83bcccedbde73
BLAKE2b-256 checksum
How to use checksums
15b50ff6a214cce80fbc2e3a5e179bb7adbfd38abdf3b02b6cc24579738dcd0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / rowx-0.1.0-cp314-abi3-macosx_11_0_arm64.whl

Download URL rowx-0.1.0-cp314-abi3-macosx_11_0_arm64.whl
Size 3.5 MB
Tags CPython 3.14 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f330ee0ccec3fd37dd23be89a4ac0e7ba2c059f1226e47c086a4997f0d7c2c79
BLAKE2b-256 checksum
How to use checksums
2629759a37447ea5e5065a060bc19dbe824afc2e704c5d176a2033d5bd8bc303
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for rowx 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No 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