Larz › Zero-dependency PostgreSQL in Python

PostgreSQL with zero dependencies

Most Python apps reach for psycopg (a C extension). Larz talks to Postgres with a driver written entirely in the standard library — including modern SCRAM-SHA-256 auth.

pip install larz
from larz.models import connect
connect("postgres://user:pass@localhost:5432/mydb")   # ORM now uses Postgres
# sqlite stays the zero-config default:
connect("app.db")

QuickstartGitHubDocs

What the driver does

The same ORM you use on sqlite runs unchanged on Postgres — it's verified end-to-end against a live PostgreSQL 15 server. sqlite remains the default so small apps stay zero-config.

FAQ

Does it really not use psycopg?

Correct — larz.pg implements the PostgreSQL wire protocol and SCRAM-SHA-256 auth with only the Python standard library. There is no psycopg, no libpq and no C extension.

Is it safe from SQL injection?

Yes — queries are parameterized via Postgres's extended protocol, so values are always sent as data, never interpolated into SQL.

Do I have to switch off sqlite?

No. sqlite is the zero-config default; passing a postgres:// URL to connect() is all it takes to use Postgres instead.