Repository navigation
v0.3.0
·
94 commits
to main
since this release
Immutable
release. Only release title and notes can be modified.
sqlty 0.3.0 adds a language server and a VS Code extension, types the parameters of a query, checks queries built in branches, and reads row types without running your code.
pip install -U sqlty # or: uv add sqlty@latestUpgrading
- The
type-modulessetting is removed.checkreads row types from source and never imports a module, not even the standard library or Pydantic, so checking an untrusted pull request is safe. Delete the key; a field whose type cannot be read from source is unknown and never reported (#797) unknown-columnis fixable: when one column of the tables in scope is the likely spelling, the message suggests it andsqlty check --fixwrites it (#816)sqlty check --output-format jsonadds thestartandendof what a diagnostic underlines and itsfixedits (#806)- The new rule
params-type-mismatchis an error by default. It reports only aPofSQL[R, P]that you wrote, so existing code is unchanged (#794)
Editors
sqlty serveris a language server for Python files, with the fixes ofsqlty check --fixas quick fixes andsource.fixAll.sqltyfor fix on save (#806, #807, #808)- The VS Code extension runs the
sqltyyour project pins, so the editor reports what CI reports. It is published to the Visual Studio Marketplace and Open VSX with each release (#809, #812, #813) sqlty.breaking.againstshowssqlty breakingfindings in the editor, forward as you edit and backward when the schema changes (#810)- An unknown name is underlined inside the query string (#811)
Typed parameters
SQL[R, P]types the parameters of a query next to its rows, andbind(params)checks them on every type checker (#791)param-types = truemakessqlty rewriteandcheck --fixwriteP: atuple, or a generatedTypedDictfor named parameters. It is off by default because type checkers then reject calls the driver runs (#792)params-type-mismatchreports aPthat does not fit its query (#794)
Query variants (preview)
With preview = true, a query built from static values bound in branches is checked along every path instead of being skipped as dynamic-query. max-query-variants (default 64) caps the paths; a query with more is reported and never checked in part (#785)
Row types from source
- Aliases, string annotations and
from __future__ import annotationsof row types resolve from source (#789), as do the aliases andNewTypes of helper modules (#793) - Standard-library classes resolve from typeshed's class graph (#795), and the public types of
pydantic.typesandpydantic.networks(EmailStr,AnyUrl,conint(...),Json[T]) from a table checked against Pydantic (#796)
Type inference
- MySQL's
XOR,^,<<and>>group by MySQL 8.4's operator precedence instead of PostgreSQL's (#805)
Full changelog: v0.2.2...v0.3.0