Releases: SQLAnvil/sqlanvil
v1.8.1 — Multiline rowConditions BigQuery fix
Patch release.
Fixed
- Multiline
rowConditionsassertion entries no longer compile to invalid SQL on BigQuery. Thefailing_row_conditionlabel is escaped to a single-line string literal (BigQuery single-quoted literals cannot span multiple lines), so conditions formatted across multiple lines for readability now work. Postgres/Supabase and MySQL were unaffected. (#42, PR #43)
Install: npm i -g @sqlanvil/cli@1.8.1
v1.8.0 — file exports (type: "export")
Added
type: "export"— write a query result to a Parquet / CSV / JSON file at a cloud or local location.- BigQuery compiles to native
EXPORT DATA OPTIONS(uri='gs://…/<name>_*.<ext>', …) AS <SELECT>(gs:// only; the required*is injected automatically). - Postgres / Supabase export runner-side via DuckDB:
COPY (SELECT … FROM postgres_query('pg', <SELECT>)) TO '<uri>'tos3://,gs://, Supabase Storage (S3-compatible endpoint), or a local path — closing the gap where managed Supabase can't write files itself. - One warehouse-agnostic surface:
config { type: "export", export: { location, format, overwrite, filename, options } }+ a SELECT body. - Object-store credentials live in a new
storagesection of the gitignored.df-credentials.json(keyed by scheme;local://needs none; BigQuery uses its own GCS access). - The DuckDB dependency ships with the CLI and loads only when a Postgres/Supabase export runs.
- BigQuery compiles to native
config { type: "export", export: { location: "s3://bucket/orders/", format: "parquet" } }
SELECT * FROM ${ref("orders")}npm: @sqlanvil/cli@1.8.0, @sqlanvil/core@1.8.0
🤖 Generated with Claude Code
v1.7.0 — named environments
Added
--environment <name>(compile/run/test) — load a named environment from aworkflow_settings.yamlenvironments:block, bundling itsschemaSuffix/vars/defaultDatabase/defaultLocationoverrides and its own credentials file.- Precedence: explicit CLI flag > environment > workflow_settings defaults (
varsmerge per-key). - Secrets stay in gitignored
.df-credentials*.jsonfiles — the committedenvironments:block holds only non-secret overrides + a credentials-file pointer. --schema-suffixremains the low-level primitive.
- Precedence: explicit CLI flag > environment > workflow_settings defaults (
environments:
dev: { schemaSuffix: dev, credentials: .df-credentials.dev.json }
prod: { defaultDatabase: prod_db, vars: { region: us-prod }, credentials: .df-credentials.prod.json }npm: @sqlanvil/cli@1.7.0, @sqlanvil/core@1.7.0
🤖 Generated with Claude Code
v1.6.0 — MySQL/MariaDB: options, comments, matviews
Three MySQL/MariaDB adapter features land on top of the 1.5.0 base adapter.
Added
mysql: {}config block (#36) — secondary indexes (plain/unique) + table options (engine / charset / collation) ontable+incrementalmodels.- COMMENT metadata (#37) —
description:/columns:apply as real table/column comments (full column-definition reconstruction soMODIFY COLUMNdrops nothing) and read back viainformation_schema. Views excepted. - Materialized view emulation (#38) —
type: "view", materialized: truebuilds a refreshed real-table snapshot (drop + CTAS each run, honoringmysql:{}) instead of erroring.
All three validated against MySQL 8 and MariaDB 11.
Deferred (#35)
Partitioning, FULLTEXT/SPATIAL/prefix indexes, row_format, MySQL source introspect.
npm: @sqlanvil/cli@1.6.0, @sqlanvil/core@1.6.0
🤖 Generated with Claude Code
v1.5.0 — MySQL/MariaDB adapter
MySQL/MariaDB adapter: a single mysql warehouse adapter generating portable MySQL-dialect SQL, verified against MySQL 8 and MariaDB 11.
Added: MysqlConnection credentials, core mysql acceptance + backtick quoting, the adapter triad (MysqlExecutionSql / MySqlPoolExecutor / MySqlDbAdapter via mysql2), CLI wiring (init --warehouse mysql, run/test), and integration tests against mysql:8 + mariadb:11.
Deferred: materialized views (error only), a mysql:{} options block, COMMENT metadata, MySQL source introspect.
npm: @sqlanvil/cli@1.5.0, @sqlanvil/core@1.5.0
🤖 Generated with Claude Code
SQLAnvil 1.4.1
Patch release fixing two Postgres adapter bugs found in the 1.4.0 acceptance pass (#17).
Fixes
- #31 —
postgres.indexesentries without anameno longer fail with zero-length delimited identifier. An index name is now derived (<table>_<cols>_idx,_keyfor unique) when omitted. - #32 — failing SQL statements no longer print a misleading
Release called on client which has already been releasedstack trace before the real error; the pg client is released exactly once.
Install
npm i -g @sqlanvil/cli@1.4.1DF_VERSION stays 3.0.59.
SQLAnvil 1.4.0
Highlights
compile node selection — sqlanvil compile now accepts the same selection flags as run/build to filter the compiled output to the action(s) you care about, mirroring dbt compile --select:
sqlanvil compile --actions my_model --json
sqlanvil compile --tags daily --include-deps --jsonSupports --actions, --tags, --include-deps, --include-dependents. The whole project still compiles (ref() resolution needs every action registered); this filters the printed graph via the same prune() that run/build use. A selector matching nothing emits an empty graph and exits 0. (#26)
Output-focused help text for the compile selection flags so compile --help reads correctly (filters output rather than executing). (#29)
Install
npm i -g @sqlanvil/cli@1.4.0DF_VERSION stays 3.0.59 (no upstream sync this release).
v1.3.0 — Postgres partitioning, incremental-table tests, ref tie-break
Backward-compatible feature release. Install/upgrade: npm i -g @sqlanvil/cli@1.3.0.
Features
-
Default schema/database tie-break for ambiguous
ref()(#22). When a name-onlyref()/resolve()/.dependencies()matches actions in multiple schemas or databases, the single candidate in the project'sdefaultSchema/defaultDatabaseis preferred (narrowing only on the qualification levels the reference omits). If no single candidate matches the defaults, the existing "Ambiguous Action name" error is preserved. Common in Postgres where the same name lives in several schemas. -
Unit tests on incremental datasets (#20).
type: "test"on anincrementaldataset now compiles and runs, exercising the non-incremental (full-refresh/create) form of the query —when(incremental())clauses resolve to their false branch, withref()/resolve()replaced by the provided inputs. -
Postgres partitioning: tablespace on partitioned parents + sub-partitioning (#21). A partitioned parent now honors
postgres.tablespace(default placement inherited by children). New recursivepostgres.partition.partitions[].subPartitionmakes a child aPARTITION BYparent of its own sub-partitions (nested any depth); the single loadINSERTcascades through the whole hierarchy.
Fixes
- Unit-test result comparison is no longer silently truncated (#19). Test queries were capped at 1 MB, so rows past the cap were never compared — a test could falsely pass (or falsely fail on divergent truncation). Test result sets are now compared in full.
Full diff: v1.2.0...v1.3.0
v1.2.0
New capability — Postgres/Supabase sources in named connections are now runnable (#14)
Previously, a platform: postgres/supabase source under connections: compiled but failed at run time (no credentials on the foreign server). Now the FDW bridge emits a CREATE USER MAPPING, and run injects the source user/password from .df-credentials.json's connections map at execution time.
- Compile emits non-secret placeholders (
${SA_CONN:<conn>:user|password}) — secrets never enter the compiled graph or--dry-run/--jsonoutput. - Run substitutes them at the execution choke point, with fail-fast validation if a connection's creds are missing.
- BigQuery sources (non-secret
saKeyIdpath) are unchanged. - Verified with core unit tests, a CLI substitution unit test, and a live-Postgres integration test (loopback
postgres_fdwreading through the foreign table).
For Postgres/Supabase sources: put non-secret host/port/database in workflow_settings.yaml's connection, and the secret user/password under connections.<name> in .df-credentials.json.
v1.1.2
Fix
introspect+runcan now share one.df-credentials.json. Source-connection
credentials forsqlanvil introspectgo under aconnections: { <name>: {...} }map,
alongside the flat write-warehouse credentials.runvalidates the warehouse creds and
ignoresconnections;introspectreads from it. Previously the two were mutually
exclusive (the strict warehouse-creds validator rejected the per-connection keys
introspectrequired), so the named-connections introspect workflow couldn't be used in
a real project. Backward-compatible: a flat file with noconnectionskey is unchanged.
Docs
- Named-connections docs scoped to BigQuery sources (the supported path). Postgres/Supabase
sources compile but aren't yet runnable (thepostgres_fdwuser mapping isn't emitted) —
tracked for a future release.