https://sqg.dev/blog/java-streams-and-list-types/ Skip to content SQG - Compile SQL to Type-Safe Code Search CtrlK Cancel PlaygroundGitHubRSS Blog Select theme [Auto ] * All posts * Recent posts + SQG v0.10.0: Java Streams & List Type Support + PostgreSQL Support & Built-in Migration Tracking + SQLite Driver Benchmark: Comparing better-sqlite3, node:sqlite, libSQL, Turso + Introducing SQG * RSS PlaygroundGitHubRSS Blog Select theme [Auto ] On this page * Overview * Java: Stream-based result methods * Java: Better array/list field support * DuckDB: List types in Appender On this page * Overview * Java: Stream-based result methods * Java: Better array/list field support * DuckDB: List types in Appender SQG v0.10.0: Java Streams & List Type Support Mar 5, 2026 Uwe Maurer SQG is a type-safe SQL code generator -- you write .sql files with annotated queries, and it generates strongly-typed database access code for TypeScript and Java by introspecting your queries against real database engines at build time. Here's what's new in v0.10.0. Java: Stream-based result methods Section titled "Java: Stream-based result methods" Generated Java code now includes methods that return Stream in addition to List. This gives you lazy evaluation, easier composition with the standard library, and avoids materializing large result sets into memory when you don't need to. try (Stream users = queries.getAllUsersStream()) { users.forEach(user -> process(user)); } The stream holds a reference to the underlying ResultSet, so it needs to be closed after use -- hence the try-with-resources. Java: Better array/list field support Section titled "Java: Better array/list field support" Array columns like TEXT[] or INTEGER[] are now handled correctly in generated Java code. Previously these types could produce incorrect mappings -- they now resolve to proper List, List, etc. DuckDB: List types in Appender Section titled "DuckDB: List types in Appender" The DuckDB appender now supports list/array column types. If your table has a column like tags VARCHAR[], the generated appender method accepts the corresponding list type and writes it correctly using DuckDB's bulk insert API. --------------------------------------------------------------------- Upgrade with npm install -g @sqg/[email protected] or update your project's dependency. Full source on GitHub. Try it out in the playground. Discuss this on Hackernews. PostgreSQL Support & Built-in Migration Tracking Edit page