PostgreSQL
The same ORM, now on Postgres — with a driver written entirely in the standard library.
class=kw>from larz.models class=kw>import connect
connect("postgres://user:pass@localhost:5432/mydb") class=com># ORM now uses Postgres
class=com># sqlite stays the zero-config default:
connect("app.db")
Nothing else in your models or queries changes — create_table(), save(),
where(...) and the rest work the same. Larz translates its SQL to PostgreSQL and maps
types for you.
The driver (larz.pg)
- The PostgreSQL v3 wire protocol over a raw socket.
- SCRAM-SHA-256 authentication (RFC 7677, the modern default), plus md5 and cleartext.
- Parameterized, injection-safe queries via the extended protocol.
- Zero dependencies — no psycopg, no libpq, no C extension.
class=com># use the driver directly if you like:
class=kw>from larz.pg class=kw>import connect as pg
cx = pg("postgres://user:pass@localhost/mydb")
rows = cx.run("SELECT * FROM users WHERE id = $1", [1])
Verified end-to-end against a live PostgreSQL 15 server. Guide: zero-dependency Postgres in Python.