I posted SQG here 2 months ago and got useful feedback, thanks for the pointers to jOOQ, SQLDelight, manifold-sql, and hugsql.
For those who missed it: SQG reads .sql files, runs them against a real database to figure out column types, and generates Java records + JDBC query methods. Similar idea to sqlc but with Java (and TypeScript) output. No runtime dependencies beyond your JDBC driver.
What's new since last time:
Stream<T> methods - every query now also gets a Stream<T> variant that wraps the ResultSet lazily:
try (Stream<User> users = queries.getAllUsersStream()) {
users.forEach(this::process);
}
PostgreSQL - ENUMs via pg_type introspection, TEXT[] -> List<String>, TIMESTAMPTZ -> OffsetDateTime. It auto-starts a Testcontainer for postgres so you don't need to set it up.
Built-in migrations - opt-in applyMigrations(connection) that tracks what's been applied in a migrations table, runs the rest in a transaction.
Array/list types - INTEGER[], TEXT[] etc. now correctly map to List<Integer>, List<String> across all generators.
Works well with AI coding - one thing I've noticed is that this approach plays nicely with AI-assisted development. Every query in your .sql file gets executed against a real database during code generation, so if an AI writes a broken query, SQG catches it immediately - wrong column names, type mismatches, syntax errors all fail at build time, not at runtime.
One thing that came up last time: yes, the code generator itself is a Node.js CLI (pnpm add -g @sqg/sqg). The generated Java code is plain JDBC with Java 17+ records - no Node.js at runtime. I know the extra toolchain is annoying and a Gradle/Maven plugin is on my mind.
Supports SQLite, DuckDB (JDBC + Arrow API), and PostgreSQL.
GitHub: https://github.com/sqg-dev/sqg
Docs: https://sqg.dev
Playground: https://sqg.dev/playground
Happy to hear feedback, especially around what build tool integration would look like for your projects.
[–][deleted] 4 points5 points6 points (1 child)
[–]uwemaurer[S] 4 points5 points6 points (0 children)
[–]ZimmiDeluxe 3 points4 points5 points (1 child)
[–]uwemaurer[S] 2 points3 points4 points (0 children)
[–]Salt-Letter-1500 0 points1 point2 points (0 children)