What's new
Database-backed query analysis
With a database connection configured, sqlc generate
will gather metadata from that database to support its query analysis. Turning this on resolves a large number of issues in the backlog related to type inference and more complex queries. The easiest way to try it out is with managed databases.
The database-backed analyzer currently supports PostgreSQL, with MySQL and SQLite support planned in the future.
New createdb
command
When you have a cloud project configured, you can use the new sqlc createdb
command to spin up a new ephemeral database with your schema and print its connection string to standard output. This is useful for integrating with other tools. Read more in the managed databases documentation.
Support for pgvector
If you're using pgvector, say goodbye to custom overrides! sqlc now generates code using pgvector-go as long as you're using pgx
. The pgvector extension is also available in managed databases.
Go build tags
With the new emit_build_tags
configuration parameter you can set build tags for sqlc to add at the top of generated source files.
What's Changed
- chore(endtoend): Fix test output for do tests by @kyleconroy in #2782
- docs: Add stable anchors to changelog by @kyleconroy in #2784
- build(deps): bump packaging from 23.1 to 23.2 in /docs by @dependabot in #2791
- Update changelog.md by @kyleconroy in #2796
- docs: Add sqlc upload to CI / CD guide by @kyleconroy in #2797
- build(deps): bump urllib3 from 2.0.5 to 2.0.6 in /docs by @dependabot in #2798
- build(deps): bump babel from 2.12.1 to 2.13.0 in /docs by @dependabot in #2799
- test(endtoend): Split shema and queries by @kyleconroy in #2803
- test: Fix a few incorrect testcases by @kyleconroy in #2804
- build(deps): bump golang.org/x/sync from 0.3.0 to 0.4.0 by @dependabot in #2810
- build(deps): bump golang from 1.21.1 to 1.21.2 by @dependabot in #2811
- feat(codegen): add support for build tags (#2012) by @Hyuga-Tsukui in #2807
- docs: fix broken link, add clarity to plugins doc by @andrewmbenton in #2813
- feat(generate): reorder codegen handlers to prefer plugins by @andrewmbenton in #2814
- docs: add clarity and reference to JSON tags by @kalogs-c in #2819
- build(deps): bump github.com/google/go-cmp from 0.5.9 to 0.6.0 by @dependabot in #2826
- build(deps): bump golang from 1.21.2 to 1.21.3 by @dependabot in #2824
- build(deps): bump google.golang.org/grpc from 1.58.2 to 1.58.3 by @dependabot in #2825
- ci: bump go version in workflows by @andrewmbenton in #2835
- refactor(codegen): remove golang and json settings from plugin proto by @andrewmbenton in #2822
- feat(devenv): add vscode settings.json with auto newline by @andrewmbenton in #2834
- feat(generate): support yml extension by @xsadia in #2828
- build(deps): bump golang.org/x/net from 0.12.0 to 0.17.0 by @dependabot in #2836
- feat(analyzer): Analyze queries using a running PostgreSQL database by @kyleconroy in #2805
- fix(codegen): Correct column names in :copyfrom by @kyleconroy in #2838
- feat(sql/ast): Render AST to SQL by @kyleconroy in #2815
- docs: Replace form with dashboard link by @kyleconroy in #2840
- fix(compiler): Search SELECT and UPDATE the same way by @kyleconroy in #2841
- fix(dolphin): Support more UNIONs for MySQL by @kyleconroy in #2843
- fix(compiler): Account for parameters without parents by @kyleconroy in #2844
- fix(postgresql): Remove temporary pool config by @kyleconroy in #2851
- fix(golang): Escape reserved keywords by @kyleconroy in #2849
- fix(mysql): Handle simplified CASE statements by @kyleconroy in #2852
- feat(codegen): Include plugin information by @kyleconroy in #2846
- fix(engine/dolphin): support enum in ALTER definition by @sapk in #2680
- fix(mysql): Add, drop, rename and change enum values by @kyleconroy in #2853
- feat(postgresql): Add ALTER VIEW ... SET SCHEMA by @kyleconroy in #2855
- fix(config): Validate
database
config in all cases by @andrewmbenton in #2856 - test: Add more database analyzer test cases by @kyleconroy in #2854
- feat(compiler): Parse query parameter metadata from comments by @andrewmbenton in #2850
- fix(compiler): Use correct func signature for
CommentSyntax
on windows by @andrewmbenton in #2867 - fix(codegen/go): Prevent filtering of embedded struct fields by @andrewmbenton in #2868
- fix(compiler): Support functions with OUT params by @kyleconroy in #2865
- docs: Update examples to use pgx/v5 by @andrewmbenton in #2863
- test: Add more analyzer test cases by @andrewmbenton in #2866
- build(deps): bump urllib3 from 2.0.6 to 2.0.7 in /docs by @dependabot in #2872
- patch: use docker compose v2 and update MYSQL_DATABASE env var by @juanjuanzero in #2870
- build(deps): bump google.golang.org/grpc from 1.58.3 to 1.59.0 by @dependabot in #2876
- feat(postgresql): Support system columns on tables by @kyleconroy in #2871
- feat(compiler): Support LEFT JOIN on aliased table by @kyleconroy in #2873
- fix(compiler): Pull in array information from analyzer by @kyleconroy in #2864
- test: Add more test cases for new analyzer by @kyleconroy in #2879
- feat: Improve messaging for common cloud config and rpc errors by @andrewmbenton in #2885
- fix(analyzer): Error on unexpanded star expression by @kyleconroy in #2882
- test(endtoend): Enabled managed-db tests in CI by @kyleconroy in #2883
- feat: Abort compiler when rpc fails as unauthenticated by @andrewmbenton in #2887
- feat(codegen): Add support for pgvector and pgvector-go by @kyleconroy in #2888
- docs: Update getting started guides, use pgx for Postgres guide by @andrewmbenton in #2891
- docs: Use managed databases in PostgreSQL getting started guide by @andrewmbenton in #2892
- test: Enabled pgvector tests for managed dbs by @kyleconroy in #2893
- feat(analyzer): Cache query analysis by @kyleconroy in #2889
- fix(vet): Remove rollback statements from DDL by @kyleconroy in #2895
- feat(createdb): Create ephemeral databases by @kyleconroy in #2894
- docs: Update managed databases doc to discuss codegen by @andrewmbenton in #2897
- docs: Add managed dbs to CI/CD and vet guides by @kyleconroy in #2896
- feat(debug): Add databases=managed debug option by @kyleconroy in #2898
- build(deps): Upgrade wasmtime-go from 13.0.0 to 14.0.0 by @kyleconroy in #2900
- feat(config): Remove managed database validation by @kyleconroy in #2901
- refactor(codegen): Removed deprecated code and improved speed by @quenbyako in #2899
- docs: Document database-backed query analyzer by @kyleconroy in #2904
- docs: Release notes for v1.23.0 by @andrewmbenton in #2907
- Release v1.23.0 by @kyleconroy in #2908
New Contributors
- @Hyuga-Tsukui made their first contribution in #2807
- @kalogs-c made their first contribution in #2819
- @xsadia made their first contribution in #2828
- @sapk made their first contribution in #2680
- @juanjuanzero made their first contribution in #2870
- @quenbyako made their first contribution in #2899
Full Changelog: v1.22.0...v1.23.0