v1.20.0 #2550
kyleconroy
announced in
Announce
v1.20.0
#2550
Replies: 1 comment
-
Could you publish a new version on snap |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Release Notes
kyleconroy/sqlc
is nowsqlc-dev/sqlc
We've completed our migration to the sqlc-dev/sqlc repository. All existing links and installation instructions will continue to work. If you're using the
go
tool to installsqlc
, you'll need to use the new import path to get v1.20.0 (and all future versions).We designed the upgrade process to be as smooth as possible. If you run into any issues, please file a bug report via GitHub.
Use
EXPLAIN ...
output in lint rulessqlc vet
can now runEXPLAIN
on your queries and include the results for use in your lint rules. For example, this rule checks thatSELECT
queries use an index.The expression environment has two variables containing
EXPLAIN ...
output,postgresql.explain
andmysql.explain
.sqlc
only populates the variable associated with your configured database engine, and only when you have a database connection configured.For the
postgresql
engine,sqlc
runswhere
"..."
is your query string, and parses the output into aPostgreSQLExplain
proto message.For the
mysql
engine,sqlc
runsEXPLAIN FORMAT=JSON ...
where
"..."
is your query string, and parses the output into aMySQLExplain
proto message.These proto message definitions are too long to include here, but you can find them in the
protos
directory within thesqlc
source tree.The output from
EXPLAIN ...
depends on the structure of your query so it's a bit difficult to offer generic examples. Refer to the PostgreSQL documentation and MySQL documentation for more information.When building rules that depend on
EXPLAIN ...
output, it may be helpful to see the actual JSON returned from the database.sqlc
will print it When you set the environment variableSQLCDEBUG=dumpexplain=1
. Use this environment variable together with a dummy rule to seeEXPLAIN ...
output for all of your queries.Opting-out of lint rules
For any query, you can tell
sqlc vet
not to evaluate lint rules using the@sqlc-vet-disable
query annotation.Bulk insert for MySQL
Developed by @Jille
MySQL now supports the
:copyfrom
query annotation. The generated code uses the LOAD DATA command to insert data quickly and efficiently.Use caution with this feature. Errors and duplicate keys are treated as warnings and insertion will continue, even without an error for some cases. Use this in a transaction and use
SHOW WARNINGS
to check for any problems and roll back if necessary.Check the error handling documentation for more information.
LOAD DATA
support must be enabled in the MySQL server.CAST support for MySQL
Developed by @ryanpbrewster and @RadhiFadlillah
sqlc
now understandsCAST
calls in MySQL queries, offering greater flexibility when generating code for complex queries.SQLite improvements
AA slew of fixes landed for our SQLite implementation, bringing it closer to parity with MySQL and PostgreSQL. We want to thank @orisano for their continued dedication to improving
sqlc
's SQLite support.What's Changed
EXPLAIN ...
for queries to the CEL program environment by @andrewmbenton in feat(vet): Add output fromEXPLAIN ...
for queries to the CEL program environment #2489prepareable()
func and a var name collision by @andrewmbenton in fix(vet): clean up unnecessaryprepareable()
func and a var name collision #2509buf format -w
by @andrewmbenton in chore(proto): reformat protos usingbuf format -w
#2536New Contributors
Full Changelog: v1.19.1...v1.20.0
This discussion was created from the release v1.20.0.
Beta Was this translation helpful? Give feedback.
All reactions