release notes — September 25, 2023

Managed databases with sqlc vet in v1.22.0

sqlc is a command line tool that generates type-safe code from SQL. Today we released sqlc v1.22.0, so let’s take a look at what’s new.

Managed databases

A few months ago we introduced sqlc vet to run your queries through a set of lint rules. These rules can prepare queries and access EXPLAIN output. Naturally these rules need access to a running database, and until today you had to provide your own.

sqlc can now create and maintain hosted databases for linting queries or running other tests in your development and CI environments. PostgreSQL support launches in beta today with MySQL support planned for the future. Sign up here for early access, or send us an email at hello@sqlc.dev.

We are already using these managed databases in sqlc’s own CI pipeline. For instance, we have examples in the sqlc-dev/sqlc repo with tests that exercise the code sqlc generates. We’ve updated these tests to use our managed databases. Creating a database for each test ensures that every test starts from a clean slate.

We also updated the sqlc.yaml configurations for all of those examples to enable managed databases for sqlc vet. So we can now run all of our CI jobs without depending on a PostgreSQL sidecar running alongside our job runners. Take a look at this pull request for details.

And finally, we already test sqlc using a large suite of end-to-end integration tests. With managed databases we’ve added a new ddl test to ensure that all end-to-end tests themselves have a valid schema. Each pull request now seamlessly creates (and drops) about 1000 databases.

You can read more about how to configure this latest sqlc feature in the managed databases documentation.

Smaller bug fixes and improvements

sqlc now supports DO statements using the :exec query annotation. We fixed a regression in the last release that resulted in incorrect Go imports in some instances. Users of the SQLite engine can now insert more than one set of values. And many more. See the changelog for a complete list.

GopherCon 2023

Last but not least, we’ll be at GopherCon 2023 this coming Wednesday and Thursday wearing bright blue “sqlc” shirts. We’d love to hear how you’re using sqlc, so come find us and say “hi.”

< All posts