Scythe¶
Polyglot SQL-to-code generator with built-in linting and formatting.
Write SQL. Get type-safe code. In any language.
Why Scythe¶
- 10 languages, 34 backend drivers -- Rust, Python, TypeScript, Go, Java, Kotlin, C#, Elixir, Ruby, PHP
- 5 databases -- PostgreSQL, MySQL, SQLite, DuckDB, CockroachDB -- all 10 languages supported on every engine
- 93 lint rules (22 custom + 71 sqruff) -- catch bugs before they ship
- SQL formatting -- via sqruff integration
- Smart type inference -- nullability from JOINs, COALESCE, window functions, aggregates
- Configurable row types -- Pydantic, msgspec, Zod, or language defaults per backend
@optionalparameters -- SQL rewriting for conditional filters without dynamic query building
Quick Install¶
cargo install scythe-cli
# or
brew install Goldziher/tap/scythe
30-Second Example¶
-- @name GetUserOrders
-- @returns :many
SELECT u.id, u.name, o.total, o.notes
FROM users u
LEFT JOIN orders o ON u.id = o.user_id
WHERE u.status = $1;
Scythe knows o.total and o.notes are nullable (right side of LEFT JOIN) and generates type-safe code:
Learn More¶
- Quickstart -- from zero to generated code in 5 minutes
- Philosophy -- why compile SQL instead of using an ORM
- Alternatives -- how scythe compares to sqlc, SQLDelight, jOOQ, and ORMs