Real SQL
Write standard SQL that runs directly against your database. No proprietary query language to learn.
Write your queries in plain SQL with simple annotations. SQG introspects your database at build time and generates fully typed code.
-- QUERY find_user :oneSELECT * FROM users WHERE email = ${email};becomes
// TypeScriptfindUser(email: string): User | undefined// Javapublic UserRow findUser(String email) throws SQLExceptionNo ORMs. No query builders. Just SQL and types.
Real SQL
Write standard SQL that runs directly against your database. No proprietary query language to learn.
True Type Safety
Types are introspected from your actual schema at build time. Catch errors before production.
Multiple Databases
SQLite, DuckDB, and PostgreSQL. Same annotations work across all engines.
TypeScript & Java
Generate code for multiple languages from the same SQL definitions.
Most tools try to parse SQL to figure out types. SQG takes a simpler approach: run the query.
Your migrations set up the schema, SQG executes your queries against a real database, and captures the exact column names and types from the result. No parser limitations, no guessing—100% accurate types.
| ORMs | SQG |
|---|---|
| Learn a query builder API | Write standard SQL |
| Types generated from models | Types introspected from queries |
| Hidden SQL, hard to optimize | Transparent, debuggable |
| Runtime query translation | No runtime overhead |
SQG is for developers who want the safety of typed code without giving up control over their SQL.
| Generator | Database | Language |
|---|---|---|
typescript/sqlite | SQLite | TypeScript (sync) |
typescript/duckdb | DuckDB | TypeScript (async) |
java/sqlite, java/duckdb, java/postgres | SQLite, DuckDB, PostgreSQL | Java (JDBC) |
java/duckdb/arrow | DuckDB | Java (Arrow API) |
SQG’s @set syntax is compatible with DBeaver, the popular open-source database IDE. Develop and test your queries interactively, then run SQG to generate code.
SQG is open source under the Apache 2.0 license.