Replace ORM complexity with SQL-first codegen
Project description
nORM
Write the SQL you want. Generate the typed API you need.
One tool for your database schema, queries, and typed data-layer code.
nORM (no ORM) is a SQL-first toolkit for managing your database and the code that talks to it. You define schema and repository SQL in one place; nORM generates typed data access code for your stack. Python is available today. Rust, Go, and TypeScript generators are in progress, and a migrations workflow is planned, so the same norm CLI can eventually cover schema changes and repositories across languages.
If you like sqlc, the workflow will feel familiar: you keep writing real queries, and nORM removes the repetitive mapping code. It also adds helpers for dynamic filters, sorting, partial updates, and join embedding that are painful to maintain by hand.
Example (Python)
Schema (norm_in/schema.sql):
CREATE TABLE users (
id SERIAL PRIMARY KEY,
name text NOT NULL,
blocked bool DEFAULT false
);
Repository SQL (norm_in/repositories/users_repo.sql):
-- repo_name: UsersRepo
-- name: get_user :one
SELECT * FROM users WHERE id = :id;
-- name: list_users :many
SELECT * FROM users ORDER BY name;
Generated usage:
from norm_out.users_repo import UsersRepo
async with get_db() as db:
repo = UsersRepo(db)
user = await repo.get_user(id=42) # User | None
users = await repo.list_users() # list[User]
Run norm init and norm generate to produce norm_out/ with Pydantic models and async repository methods. The same SQL inputs will drive other language targets as they land. See the Python tutorial for config, CRUD, and project layout.
Why nORM?
- One workflow for schema and data layer. Keep database definitions and repository SQL together instead of splitting schema management, query authoring, and hand-written mapping code across different tools.
- SQL stays in charge. Queries and execution plans stay visible; no ORM query builder in the middle.
- Typed APIs from your SQL. Parameters, return types, and row mapping are generated to match what you wrote.
- Dynamic queries without string assembly. Optional filters, sort orders, patch updates, and nested join shapes are expressed in SQL and compiled into safe, typed code.
Dynamic filtering
Prefix a parameter with _ to make it optional. One query can cover many filter combinations:
-- name: search_authors :many
SELECT * FROM authors
WHERE id = :_id OR rating > :rating;
# rating is required; id is optional (defaults to UNSET)
await repo.search_authors(rating=4)
await repo.search_authors(rating=4, id=7)
Dynamic filtering guide · Dynamic sorting · Partial updates · Embedding models
Who this is for
Good fit if you want visible SQL, less boilerplate, strongly typed data access, and runtime filters without hand-built SQL strings.
Not a fit if you prefer designing queries through ORM method chains. Use SQLAlchemy or similar instead.
Install
The CLI is a Python package today (requires 3.12+). Install norm-cli from PyPI; the command on your PATH is norm:
pipx install norm-cli
norm --version
From a checkout: pip install . (same norm command).
Quick start
norm init
# edit norm_in/schema.sql and norm_in/repositories/*.sql
norm generate
Other useful commands: norm schema pull (introspect Postgres), norm check (CI-friendly validation). See commands. Migrations are planned.
Language & database support
nORM is language-agnostic at the core: the same schema and repository SQL feed each code generator.
| Language | Status | Databases |
|---|---|---|
| Python | Available | Postgres, SQLite, MySQL, ClickHouse, DuckDB |
| Rust, Go, TypeScript | In progress | TBD per target |
Contributing
Bug reports, ideas, and PRs are welcome. See CONTRIBUTING.md for local setup and docs workflow.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file norm_cli-0.1.0.tar.gz.
File metadata
- Download URL: norm_cli-0.1.0.tar.gz
- Upload date:
- Size: 80.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e2ec4255ffece9c178004f304126353b425610f44f603c2f926358498bde1ab
|
|
| MD5 |
2c404f85db452cb8f7cd9498fc247ce6
|
|
| BLAKE2b-256 |
876ee957c66ec0283becd8cc96182bc87dcd010ebe1da1bd38d4c3871b85369a
|
Provenance
The following attestation bundles were made for norm_cli-0.1.0.tar.gz:
Publisher:
publish.yml on devfros/nORM
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
norm_cli-0.1.0.tar.gz -
Subject digest:
4e2ec4255ffece9c178004f304126353b425610f44f603c2f926358498bde1ab - Sigstore transparency entry: 1684433286
- Sigstore integration time:
-
Permalink:
devfros/nORM@ad3c56c0c768cf7700c5e735a1f2ba78d6935f8a -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/devfros
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ad3c56c0c768cf7700c5e735a1f2ba78d6935f8a -
Trigger Event:
release
-
Statement type:
File details
Details for the file norm_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: norm_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 128.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da2e98bed5ff5114dcaa2d0e3257ba16b26bfd9a43122dd5d73a37c64f99cfac
|
|
| MD5 |
42ce06bd41f7fdedc32dd69dde8c002b
|
|
| BLAKE2b-256 |
41ec62daa1c1d4b91c1af099b6561d1e19c64d296b45d18aa2b55d7bb13e976e
|
Provenance
The following attestation bundles were made for norm_cli-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on devfros/nORM
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
norm_cli-0.1.0-py3-none-any.whl -
Subject digest:
da2e98bed5ff5114dcaa2d0e3257ba16b26bfd9a43122dd5d73a37c64f99cfac - Sigstore transparency entry: 1684433361
- Sigstore integration time:
-
Permalink:
devfros/nORM@ad3c56c0c768cf7700c5e735a1f2ba78d6935f8a -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/devfros
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ad3c56c0c768cf7700c5e735a1f2ba78d6935f8a -
Trigger Event:
release
-
Statement type: