SQLStratum is a modern, typed, deterministic SQL query builder / compiler + runner + hydration pipeline. It is designed as a foundation layer for apps and ORMs, with a focus on determinism, composability, and predictable parameter binding.
- Not an ORM (no identity map, relationships, lazy loading)
- Not a migrations/DDL system
- Not a full database abstraction layer for every backend yet (SQLite first)
- Not a SQL string templating engine
sqlstratum/ast.py: core AST nodes and compiled result typessqlstratum/expr.py: expressions, predicates, aggregates, orderingsqlstratum/meta.py:Table/Columnmetadata and column accesssqlstratum/dsl.py: public DSL constructors and chaining helperssqlstratum/compile.py: AST -> SQL + params compilationsqlstratum/runner.py: SQLite execution boundary + transactionssqlstratum/hydrate/: hydration targets + projection key rulestests/: compile, hydration, runner, and SQLite integration testsexamples/: minimal usage demos
- Branch-per-release convention:
release/0.1.x-<short-name> - Keep PRs focused: one feature or bug fix per branch
- Update/add tests with every change (no exceptions)
- Avoid expanding scope beyond the roadmap
- Favor small, verifiable steps
- Use conventional commit prefixes:
feat:,fix:,docs:,test:,refactor:,chore:. - Keep commit subject in imperative mood and around 50-72 characters.
- One commit should represent one coherent change set.
- Reference version/tag work explicitly in release commits (for example:
chore: prepare v0.2.0 release). - When suggesting commit messages to users/agents, suggest exactly one concise subject line first.
- Never suggest amend/rewrite history unless explicitly requested.
- Deterministic SQL output for identical AST inputs
- Parameter binding must be safe; never interpolate raw user strings
- Aliasing rules: avoid ambiguous columns; encourage explicit aliases in joins
- Runner is the execution boundary; avoid leaking DB concerns into AST/compile layers
- Run tests with
python -m unittest - Add compile snapshot tests and SQLite execution tests when relevant
- For bugs, add minimal repro tests with expected compiled SQL + params
SQLSTRATUM_DEBUG=1enables per-query logging at the Runner boundary (requires logging level DEBUG)
- Never include absolute local filesystem paths in generated docs, release notes, examples, or prompts.
- Use project-relative paths only (for example:
README.md,docs/,sqlstratum/compile.py). - Treat machine-specific paths, usernames, and home-directory locations as sensitive and do not expose them.