Skip to content

Releases: SQLAnvil/sqlanvil

v1.8.1 — Multiline rowConditions BigQuery fix

19 Jun 17:04

Choose a tag to compare

Patch release.

Fixed

  • Multiline rowConditions assertion entries no longer compile to invalid SQL on BigQuery. The failing_row_condition label 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")

18 Jun 23:45

Choose a tag to compare

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>' to s3://, 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 storage section 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.
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

18 Jun 13:06

Choose a tag to compare

Added

  • --environment <name> (compile/run/test) — load a named environment from a workflow_settings.yaml environments: block, bundling its schemaSuffix/vars/defaultDatabase/defaultLocation overrides and its own credentials file.
    • Precedence: explicit CLI flag > environment > workflow_settings defaults (vars merge per-key).
    • Secrets stay in gitignored .df-credentials*.json files — the committed environments: block holds only non-secret overrides + a credentials-file pointer.
    • --schema-suffix remains the low-level primitive.
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

18 Jun 01:48

Choose a tag to compare

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) on table + incremental models.
  • COMMENT metadata (#37) — description: / columns: apply as real table/column comments (full column-definition reconstruction so MODIFY COLUMN drops nothing) and read back via information_schema. Views excepted.
  • Materialized view emulation (#38) — type: "view", materialized: true builds a refreshed real-table snapshot (drop + CTAS each run, honoring mysql:{}) 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

17 Jun 16:42

Choose a tag to compare

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

17 Jun 01:07
6c980dd

Choose a tag to compare

Patch release fixing two Postgres adapter bugs found in the 1.4.0 acceptance pass (#17).

Fixes

  • #31postgres.indexes entries without a name no longer fail with zero-length delimited identifier. An index name is now derived (<table>_<cols>_idx, _key for unique) when omitted.
  • #32 — failing SQL statements no longer print a misleading Release called on client which has already been released stack trace before the real error; the pg client is released exactly once.

Install

npm i -g @sqlanvil/cli@1.4.1

DF_VERSION stays 3.0.59.

SQLAnvil 1.4.0

16 Jun 22:50
1026105

Choose a tag to compare

Highlights

compile node selectionsqlanvil 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 --json

Supports --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.0

DF_VERSION stays 3.0.59 (no upstream sync this release).

v1.3.0 — Postgres partitioning, incremental-table tests, ref tie-break

14 Jun 02:34

Choose a tag to compare

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-only ref()/resolve()/.dependencies() matches actions in multiple schemas or databases, the single candidate in the project's defaultSchema/defaultDatabase is 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 an incremental dataset now compiles and runs, exercising the non-incremental (full-refresh/create) form of the query — when(incremental()) clauses resolve to their false branch, with ref()/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 recursive postgres.partition.partitions[].subPartition makes a child a PARTITION BY parent of its own sub-partitions (nested any depth); the single load INSERT cascades 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

07 Jun 11:01

Choose a tag to compare

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/--json output.
  • Run substitutes them at the execution choke point, with fail-fast validation if a connection's creds are missing.
  • BigQuery sources (non-secret saKeyId path) are unchanged.
  • Verified with core unit tests, a CLI substitution unit test, and a live-Postgres integration test (loopback postgres_fdw reading 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

07 Jun 01:24

Choose a tag to compare

Fix

  • introspect + run can now share one .df-credentials.json. Source-connection
    credentials for sqlanvil introspect go under a connections: { <name>: {...} } map,
    alongside the flat write-warehouse credentials. run validates the warehouse creds and
    ignores connections; introspect reads from it. Previously the two were mutually
    exclusive (the strict warehouse-creds validator rejected the per-connection keys
    introspect required), so the named-connections introspect workflow couldn't be used in
    a real project. Backward-compatible: a flat file with no connections key is unchanged.

Docs

  • Named-connections docs scoped to BigQuery sources (the supported path). Postgres/Supabase
    sources compile but aren't yet runnable (the postgres_fdw user mapping isn't emitted) —
    tracked for a future release.