v1.20.0 #2550
kyleconroy
announced in
Announcements
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Release Notes
kyleconroy/sqlcis nowsqlc-dev/sqlcWe'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
gotool 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 vetcan now runEXPLAINon your queries and include the results for use in your lint rules. For example, this rule checks thatSELECTqueries use an index.The expression environment has two variables containing
EXPLAIN ...output,postgresql.explainandmysql.explain.sqlconly populates the variable associated with your configured database engine, and only when you have a database connection configured.For the
postgresqlengine,sqlcrunswhere
"..."is your query string, and parses the output into aPostgreSQLExplainproto message.For the
mysqlengine,sqlcrunsEXPLAIN FORMAT=JSON ...where
"..."is your query string, and parses the output into aMySQLExplainproto message.These proto message definitions are too long to include here, but you can find them in the
protosdirectory within thesqlcsource 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.sqlcwill 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 vetnot to evaluate lint rules using the@sqlc-vet-disablequery annotation.Bulk insert for MySQL
Developed by @Jille
MySQL now supports the
:copyfromquery 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 WARNINGSto check for any problems and roll back if necessary.Check the error handling documentation for more information.
LOAD DATAsupport must be enabled in the MySQL server.CAST support for MySQL
Developed by @ryanpbrewster and @RadhiFadlillah
sqlcnow understandsCASTcalls 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 -wby @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