From 78a631c01729b6a54472d34f7227cba304619c8b Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Mon, 30 Nov 2026 11:19:51 +0000 Subject: [PATCH 1/2] feat: convert local test SQL with SQLBabel 0.39.0 Local tests and scenarios convert Snowflake SQL with the sqlbabel package, 0.39.0 from PyPI, instead of sqlquack. Refusal codes read SBL instead of SQ, and refusals and help name SQLBabel. Conversions are kept in target/sqlbabel-cache; when target/sqlquack-cache is still there, the run prints a note once saying it is no longer read and can be deleted. --- .../sqlbuild-cli/src/argv/command_table.json | 2 +- .../src/project/_helpers/sections.rs | 2 +- .../src/project/tests/test_load_config.rs | 2 +- .../src/run_on/_helpers/kinds.rs | 4 +- .../src/run_on/_helpers/summary.rs | 2 +- .../sqlbuild-core/src/run_on/_helpers/text.rs | 2 +- crates/sqlbuild-core/src/run_on/constants.rs | 6 +- .../src/run_on/main/with_run_on_json.rs | 2 +- crates/sqlbuild-core/src/run_on/models.rs | 4 +- .../sqlbuild-core/src/run_on/tests/helpers.rs | 22 +++--- .../src/run_on/tests/test_run_on.rs | 62 +++++++-------- crates/sqlbuild-core/src/run_output/models.rs | 2 +- .../src/run_output/tests/helpers.rs | 2 +- .../src/run_output/tests/test_run_output.rs | 2 +- .../src/native_host/constants.rs | 2 +- .../compile_driver/_helpers/local_tests.rs | 6 +- .../src/compile_driver/constants.rs | 2 +- .../main/local_test_inputs_problem.rs | 4 +- pyproject.toml | 2 +- .../sqlbuild/references/docs/cli/scenario.md | 8 +- .../sqlbuild/references/docs/cli/test.md | 20 ++--- .../docs/concepts/project-configuration.md | 6 +- .../references/docs/concepts/scenarios.md | 6 +- .../docs/concepts/testing-reference.md | 38 ++++----- src/sqlbuild/executor/local/__init__.py | 2 +- .../executor/local/_helpers/conversion.py | 33 +++++--- .../executor/local/_helpers/decisions.py | 2 +- .../executor/local/_helpers/local_inputs.py | 6 +- .../executor/local/_helpers/positions.py | 12 +-- .../executor/local/_helpers/runtime.py | 4 +- .../executor/local/_helpers/schema.py | 2 +- .../local/classes/local_test_adapter.py | 4 +- src/sqlbuild/executor/local/constants.py | 15 ++-- .../local/main/_check_local_test_inputs.py | 16 ++-- .../executor/local/main/_convert_local_sql.py | 4 +- .../local/main/_local_failure_refusal.py | 2 +- .../local/main/_use_local_test_inputs.py | 2 +- src/sqlbuild/executor/local/models.py | 10 +-- .../scenario/_helpers/local/execution.py | 6 +- .../scenario/_helpers/local/snapshots.py | 2 +- .../executor/scenario/_helpers/local/sql.py | 8 +- src/sqlbuild/executor/scenario/exceptions.py | 2 +- src/sqlbuild/executor/scenario/models.py | 2 +- .../cli/commands/main/compile/_test_types.py | 2 +- .../cli/commands/main/scenario/_test_types.py | 2 +- .../cli/commands/main/scenario/helpers.py | 2 +- .../main/scenario/test_authored_check_sql.py | 2 +- .../main/scenario/test_local_guard.py | 4 +- .../main/scenario/test_local_macro_dialect.py | 2 +- .../commands/main/scenario/test_scenario.py | 2 +- .../commands/main/sqlite/test_scenarios.py | 2 +- .../cli/commands/main/test/_test_types.py | 9 +++ .../cli/commands/main/test/test_run_on.py | 79 +++++++++++++++---- .../cli/project_metadata/test_dependencies.py | 4 +- .../executor/local/_helpers/_test_types.py | 2 +- .../executor/local/_helpers/helpers.py | 10 +-- .../local/_helpers/test_conversion_cache.py | 8 +- .../local/_helpers/test_local_inputs.py | 4 +- .../executor/local/_helpers/test_positions.py | 8 +- .../executor/local/_helpers/test_runtime.py | 6 +- .../scenario/_helpers/test_capture_columns.py | 4 +- .../scenario/_helpers/test_local_sql.py | 2 +- uv.lock | 62 +++++++-------- .../src/content/docs/docs/cli/scenario.mdx | 8 +- website/src/content/docs/docs/cli/test.mdx | 20 ++--- .../docs/concepts/project-configuration.mdx | 6 +- .../content/docs/docs/concepts/scenarios.mdx | 6 +- .../docs/docs/concepts/testing-reference.mdx | 38 ++++----- 68 files changed, 355 insertions(+), 283 deletions(-) diff --git a/crates/sqlbuild-cli/src/argv/command_table.json b/crates/sqlbuild-cli/src/argv/command_table.json index c8c95e146f..8b032a7d1c 100644 --- a/crates/sqlbuild-cli/src/argv/command_table.json +++ b/crates/sqlbuild-cli/src/argv/command_table.json @@ -3652,7 +3652,7 @@ "local", "warehouse" ], - "help": "Where unit tests run: auto (locally when SQLQuack converts them, otherwise on the warehouse), local or warehouse; overrides the target and [settings] test_run_on", + "help": "Where unit tests run: auto (locally when SQLBabel converts them, otherwise on the warehouse), local or warehouse; overrides the target and [settings] test_run_on", "group": 1 }, { diff --git a/crates/sqlbuild-config/src/project/_helpers/sections.rs b/crates/sqlbuild-config/src/project/_helpers/sections.rs index 1e64f98571..7bc4fc1765 100644 --- a/crates/sqlbuild-config/src/project/_helpers/sections.rs +++ b/crates/sqlbuild-config/src/project/_helpers/sections.rs @@ -1159,7 +1159,7 @@ pub(crate) fn load_testing(payload: Option<&ConfigValue>, file: ConfigFile) -> L _ => Err(ConfigFailure::at( file, format!( - "[testing.local] allow takes `{} = true` or `false` for a SQLQuack known \ + "[testing.local] allow takes `{} = true` or `false` for a SQLBabel known \ difference", key_name(name) ), diff --git a/crates/sqlbuild-config/src/project/tests/test_load_config.rs b/crates/sqlbuild-config/src/project/tests/test_load_config.rs index da4d603d21..2268d43625 100644 --- a/crates/sqlbuild-config/src/project/tests/test_load_config.rs +++ b/crates/sqlbuild-config/src/project/tests/test_load_config.rs @@ -769,7 +769,7 @@ fn given_invalid_testing_section_when_loading_then_it_is_rejected() { ReviewConfigErrorTestCase { description: "an allowance that is not true or false", project: "name = 'orders'\nadapter = 'snowflake'\n[testing.local]\nallow = { hash = 'yes' }\n", - expected_fragment: "[testing.local] allow takes `hash = true` or `false` for a SQLQuack known difference", + expected_fragment: "[testing.local] allow takes `hash = true` or `false` for a SQLBabel known difference", }, ReviewConfigErrorTestCase { description: "a misspelt testing.local key", diff --git a/crates/sqlbuild-core/src/run_on/_helpers/kinds.rs b/crates/sqlbuild-core/src/run_on/_helpers/kinds.rs index 36add50d0b..6068811421 100644 --- a/crates/sqlbuild-core/src/run_on/_helpers/kinds.rs +++ b/crates/sqlbuild-core/src/run_on/_helpers/kinds.rs @@ -1,4 +1,4 @@ -//! Who can act on a refusal: the project's SQL, a setting, SQLQuack or SQLBuild, or nobody. +//! Who can act on a refusal: the project's SQL, a setting, SQLBabel or SQLBuild, or nobody. use crate::run_on::constants::{DUCKDB_ERROR_CATEGORY, KNOWN_DIFFERENCE_CODE}; use crate::run_on::models::RefusalGroup; @@ -10,7 +10,7 @@ pub(crate) enum RefusalKind { Fix, /// A known difference the project can allow in `sqlbuild_project.toml`. Allow, - /// A construct SQLQuack or SQLBuild does not handle yet. + /// A construct SQLBabel or SQLBuild does not handle yet. Gap, /// DuckDB failed on converted SQL, or SQLBuild's own comparison holds the construct. Internal, diff --git a/crates/sqlbuild-core/src/run_on/_helpers/summary.rs b/crates/sqlbuild-core/src/run_on/_helpers/summary.rs index 8485671c22..3d4e3f2079 100644 --- a/crates/sqlbuild-core/src/run_on/_helpers/summary.rs +++ b/crates/sqlbuild-core/src/run_on/_helpers/summary.rs @@ -39,7 +39,7 @@ fn item_count(groups: &[&RefusalGroup]) -> usize { .len() } -/// `SQ0003 `, or an unplaced cause's category and its first constructs. +/// `SBL0003 `, or an unplaced cause's category and its first constructs. fn row_text(group: &RefusalGroup, code_width: usize) -> String { let code: &str = group.refusal.code.as_deref().unwrap_or(""); let text: String = if group.unplaced { diff --git a/crates/sqlbuild-core/src/run_on/_helpers/text.rs b/crates/sqlbuild-core/src/run_on/_helpers/text.rs index 880cc1f171..85f74506c9 100644 --- a/crates/sqlbuild-core/src/run_on/_helpers/text.rs +++ b/crates/sqlbuild-core/src/run_on/_helpers/text.rs @@ -53,7 +53,7 @@ pub(crate) fn group_counts(group: &RefusalGroup, nouns: (&str, &str)) -> String counts.join(" \u{00b7} ") } -/// The block's head message: the category of an unplaced group, else SQLQuack's message. +/// The block's head message: the category of an unplaced group, else SQLBabel's message. pub(crate) fn group_message(group: &RefusalGroup) -> String { let refusal: &LocalRefusal = &group.refusal; if group.unplaced { diff --git a/crates/sqlbuild-core/src/run_on/constants.rs b/crates/sqlbuild-core/src/run_on/constants.rs index 2b9ce1addf..300b8a26f8 100644 --- a/crates/sqlbuild-core/src/run_on/constants.rs +++ b/crates/sqlbuild-core/src/run_on/constants.rs @@ -9,7 +9,7 @@ pub(crate) const ON_THE_WAREHOUSE_TITLE: &str = "On the warehouse"; pub(crate) const RUNS_ON_LABEL: &str = "runs on"; /// The width the refusal report lays its counts out to when output has no terminal width. pub(crate) const REPORT_FALLBACK_COLUMNS: usize = 120; -/// What a local item relied on from the project: SQLQuack allowances and overrides. +/// What a local item relied on from the project: SQLBabel allowances and overrides. pub(crate) const RELIED_ON_LABEL: &str = "relied on"; pub(crate) const NOTE_LABEL: &str = "= note:"; pub(crate) const EXPANDED_LABEL: &str = "= expanded from"; @@ -17,8 +17,8 @@ pub(crate) const USED_BY_LABEL: &str = "= used by"; /// The help of a cause that has none of its own under `--run-on local`: `run these on the warehouse …`. pub(crate) const RUN_ELSEWHERE_HELP_PREFIX: &str = "run these "; pub(crate) const RUN_ELSEWHERE_HELP_SUFFIX: &str = " on the warehouse with --run-on auto"; -/// SQLQuack's code for a known difference the project has not allowed. -pub(crate) const KNOWN_DIFFERENCE_CODE: &str = "SQ0008"; +/// SQLBabel's code for a known difference the project has not allowed. +pub(crate) const KNOWN_DIFFERENCE_CODE: &str = "SBL0008"; /// The category of a refusal DuckDB raised while running converted SQL. pub(crate) const DUCKDB_ERROR_CATEGORY: &str = "DuckDB internal error"; pub(crate) const FIX_TITLE: &str = "Fix in your SQL"; diff --git a/crates/sqlbuild-core/src/run_on/main/with_run_on_json.rs b/crates/sqlbuild-core/src/run_on/main/with_run_on_json.rs index 43ed15b1a4..3ab34c2677 100644 --- a/crates/sqlbuild-core/src/run_on/main/with_run_on_json.rs +++ b/crates/sqlbuild-core/src/run_on/main/with_run_on_json.rs @@ -40,7 +40,7 @@ pub fn with_run_on_json( serde_json::to_string(&document).map_err(|error| error.to_string()) } -/// Each refusal once per construct and place, as SQLQuack's `--json` reports it, with its items. +/// Each refusal once per construct and place, as SQLBabel's `--json` reports it, with its items. fn refusals(decisions: &[RunOnDecision]) -> Vec { let mut found: Vec<(LocalRefusal, Vec)> = Vec::new(); for decision in decisions { diff --git a/crates/sqlbuild-core/src/run_on/models.rs b/crates/sqlbuild-core/src/run_on/models.rs index 2487bf855c..66de1fe3e6 100644 --- a/crates/sqlbuild-core/src/run_on/models.rs +++ b/crates/sqlbuild-core/src/run_on/models.rs @@ -43,7 +43,7 @@ pub struct RunOnLayers { pub settings: Option, } -/// One SQLQuack refusal, or one of SQLBuild's own reasons, placed in the file holding it. +/// One SQLBabel refusal, or one of SQLBuild's own reasons, placed in the file holding it. #[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct LocalRefusal { pub category: String, @@ -80,7 +80,7 @@ pub struct MacroPlace { } impl LocalRefusal { - /// `: `, as SQLQuack's census labels a refusal. + /// `: `, as SQLBabel's census labels a refusal. #[must_use] pub fn title(&self) -> String { format!("{}: {}", self.category, self.construct) diff --git a/crates/sqlbuild-core/src/run_on/tests/helpers.rs b/crates/sqlbuild-core/src/run_on/tests/helpers.rs index 25bb5cb0b2..eef23b2569 100644 --- a/crates/sqlbuild-core/src/run_on/tests/helpers.rs +++ b/crates/sqlbuild-core/src/run_on/tests/helpers.rs @@ -14,7 +14,7 @@ pub(super) fn local(name: &str) -> RunOnDecision { } } -/// A test SQLQuack refuses at `line` of `stg_orders.sql` for `construct`. +/// A test SQLBabel refuses at `line` of `stg_orders.sql` for `construct`. pub(super) fn refused(name: &str, construct: &str, line: i64) -> RunOnDecision { RunOnDecision { relied_on: Vec::new(), @@ -24,19 +24,19 @@ pub(super) fn refused(name: &str, construct: &str, line: i64) -> RunOnDecision { } } -/// SQLQuack's HASH refusal at `line` of `stg_orders.sql`. +/// SQLBabel's HASH refusal at `line` of `stg_orders.sql`. fn hash_refusal(construct: &str, line: i64) -> LocalRefusal { LocalRefusal { category: "a known difference that isn't allowed".to_owned(), construct: construct.to_owned(), reason: "fn:HASH needs known divergence `hash`".to_owned(), - code: Some("SQ0008".to_owned()), + code: Some("SBL0008".to_owned()), message: Some("HASH gives a different value in DuckDB".to_owned()), label: Some("DuckDB computes its own hash, never Snowflake's".to_owned()), notes: vec!["Equal inputs still get equal hashes within one run.".to_owned()], help: Some( "allow it for local tests in sqlbuild_project.toml with \ - `[testing.local] allow = { hash = true }`; `sqlquack explain hash` says when it is safe" + `[testing.local] allow = { hash = true }`; `sqlbabel explain hash` says when it is safe" .to_owned(), ), path: Some("sql/models/staging/stg_orders.sql".to_owned()), @@ -52,7 +52,7 @@ fn hash_refusal(construct: &str, line: i64) -> LocalRefusal { } } -/// A test SQLQuack refuses without a place in any file. +/// A test SQLBabel refuses without a place in any file. pub(super) fn unplaced(name: &str) -> RunOnDecision { RunOnDecision { relied_on: Vec::new(), @@ -202,8 +202,8 @@ pub(super) fn many_causes() -> Vec { LocalRefusal { category: "outside a rule's type conditions".to_owned(), construct: format!("fn:{function}"), - code: Some("SQ0003".to_owned()), - message: Some(format!("SQLQuack can't convert {function} for these types")), + code: Some("SBL0003".to_owned()), + message: Some(format!("SQLBabel can't convert {function} for these types")), label: Some("TIMESTAMP_TZ".to_owned()), notes: vec!["a Snowflake TIMESTAMP_TZ stores each value's own UTC offset; DuckDB's TIMESTAMPTZ keeps only the instant".to_owned()], help: Some(helps[index % 3].to_owned()), @@ -239,7 +239,7 @@ pub(super) fn many_causes() -> Vec { refused_with_code( &format!("test_gap_{index}"), &format!("FN_GAP_{index}"), - "SQ0002", + "SBL0002", ) .refusals[0] .clone(), @@ -254,9 +254,9 @@ pub(super) fn many_causes() -> Vec { add( format!("test_guard_{guard}"), LocalRefusal { - category: "SQLQuack guard".to_owned(), + category: "SQLBabel guard".to_owned(), construct: guard.to_owned(), - reason: format!("SQLQuack's guard {guard} raised in DuckDB"), + reason: format!("SQLBabel's guard {guard} raised in DuckDB"), width: 1, ..LocalRefusal::default() }, @@ -277,7 +277,7 @@ pub(super) fn many_causes() -> Vec { add( "test_generated".to_owned(), LocalRefusal { - message: Some("SQLQuack can't convert JOIN for these types".to_owned()), + message: Some("SQLBabel can't convert JOIN for these types".to_owned()), path: Some("tests/sql/test_generated.yml".to_owned()), line: None, generated: true, diff --git a/crates/sqlbuild-core/src/run_on/tests/test_run_on.rs b/crates/sqlbuild-core/src/run_on/tests/test_run_on.rs index 4929cd7ffd..379a48ca75 100644 --- a/crates/sqlbuild-core/src/run_on/tests/test_run_on.rs +++ b/crates/sqlbuild-core/src/run_on/tests/test_run_on.rs @@ -33,37 +33,37 @@ const MANY_CAUSES_SUMMARY: &str = " Can't run locally (35 tests): Fix in your SQL (20 tests): - SQ0003 SQLQuack can't convert FN_00 for these types 1 test · 1 model [1] - SQ0003 SQLQuack can't convert FN_01 for these types 1 test · 1 model [2] - SQ0003 SQLQuack can't convert FN_02 for these types 1 test · 1 model [3] - SQ0003 SQLQuack can't convert FN_03 for these types 1 test · 1 model [1] - SQ0003 SQLQuack can't convert FN_04 for these types 1 test · 1 model [2] - SQ0003 SQLQuack can't convert FN_05 for these types 1 test · 1 model [3] + SBL0003 SQLBabel can't convert FN_00 for these types 1 test · 1 model [1] + SBL0003 SQLBabel can't convert FN_01 for these types 1 test · 1 model [2] + SBL0003 SQLBabel can't convert FN_02 for these types 1 test · 1 model [3] + SBL0003 SQLBabel can't convert FN_03 for these types 1 test · 1 model [1] + SBL0003 SQLBabel can't convert FN_04 for these types 1 test · 1 model [2] + SBL0003 SQLBabel can't convert FN_05 for these types 1 test · 1 model [3] +14 more causes · 14 tests [1] cast the operand to one of the types the label names [2] declare the columns' Snowflake types in `sources/*.yml` [3] convert the value to a wall time first with `CONVERT_TIMEZONE('UTC', col)` Allow a known difference (2 tests): - SQ0008 HASH gives a different value in DuckDB 1 test · 1 model [4] - SQ0008 RANDOM gives a different value in DuckDB 1 test · 1 model [5] + SBL0008 HASH gives a different value in DuckDB 1 test · 1 model [4] + SBL0008 RANDOM gives a different value in DuckDB 1 test · 1 model [5] [4] allow it with `[testing.local] allow = { hash = true }` [5] allow it with `[testing.local] allow = { random = true }` Tool gaps (12 tests): - SQLQuack guard: json_fidelity, date_text_spelling +2 4 tests - project function: sku_family, luhn_valid 2 tests - SQ0002 FN_GAP_0 has no DuckDB equivalent 1 test · 1 model - SQ0002 FN_GAP_1 has no DuckDB equivalent 1 test · 1 model - SQ0002 FN_GAP_2 has no DuckDB equivalent 1 test · 1 model - SQ0002 FN_GAP_3 has no DuckDB equivalent 1 test · 1 model + SQLBabel guard: json_fidelity, date_text_spelling +2 4 tests + project function: sku_family, luhn_valid 2 tests + SBL0002 FN_GAP_0 has no DuckDB equivalent 1 test · 1 model + SBL0002 FN_GAP_1 has no DuckDB equivalent 1 test · 1 model + SBL0002 FN_GAP_2 has no DuckDB equivalent 1 test · 1 model + SBL0002 FN_GAP_3 has no DuckDB equivalent 1 test · 1 model +2 more causes · 2 tests Internal errors (1 test): - error[SQ0008]: SQLBuild problem: SQLQuack can't convert JOIN for these types 1 test + error[SBL0008]: SQLBuild problem: SQLBabel can't convert JOIN for these types 1 test = note: SQLBuild wrote this construct in the comparison it generates = help: allow it for local tests in sqlbuild_project.toml with - `[testing.local] allow = { hash = true }`; `sqlquack explain hash` says when it is safe + `[testing.local] allow = { hash = true }`; `sqlbabel explain hash` says when it is safe --> tests/sql/test_generated.yml = DuckDB computes its own hash, never Snowflake's @@ -126,7 +126,7 @@ fn given_decisions_when_counting_causes_then_groups_by_code_and_construct_most_f HeaderCause { label: "fn:HASH".to_owned(), count: 3, - detail: "SQ0008 \u{b7} 1 model".to_owned(), + detail: "SBL0008 \u{b7} 1 model".to_owned(), }, HeaderCause { label: "missing rule".to_owned(), @@ -181,27 +181,27 @@ fn given_refusals_when_rendering_report_then_groups_by_cause_and_lists_origins() decisions: vec![ refused("test_stg_orders", "fn:HASH", 26), refused("test_daily_revenue_chain", "fn:HASH", 26), - refused_with_code("test_customers", "fn:IS_DOUBLE", "SQ0002"), + refused_with_code("test_customers", "fn:IS_DOUBLE", "SBL0002"), unplaced("test_fact_orders"), local("calculates_line_total_cents"), ], errors: true, verbose: false, columns: 80, - expected_text: "\nCan't run locally (4 tests):\n\nerror[SQ0008]: HASH gives a different value in DuckDB 2 tests · 1 model\n = note: Equal inputs still get equal hashes within one run.\n = help: allow it for local tests in sqlbuild_project.toml with\n `[testing.local] allow = { hash = true }`; `sqlquack explain hash` says when it is safe\n --> sql/models/staging/stg_orders.sql:26:3\n |\n 26 | HASH(status) AS status_hash\n | ^^^^^^^^^^^^ DuckDB computes its own hash, never Snowflake's\n\nerror[SQ0002]: fn:IS_DOUBLE has no DuckDB equivalent 1 test · 1 model\n = help: run these tests on the warehouse with --run-on auto\n --> sql/models/staging/stg_orders.sql:40:3\n |\n 40 | IS_DOUBLE(payload) AS is_number\n | ^^^^^^^^^^^^^^^^^ no rule converts this function\n\nerror: missing rule 1 test\n └── node:method_call 1 test test_fact_orders\n = note: no rule converts METHOD CALL\n = help: run these tests on the warehouse with --run-on auto\n", + expected_text: "\nCan't run locally (4 tests):\n\nerror[SBL0008]: HASH gives a different value in DuckDB 2 tests · 1 model\n = note: Equal inputs still get equal hashes within one run.\n = help: allow it for local tests in sqlbuild_project.toml with\n `[testing.local] allow = { hash = true }`; `sqlbabel explain hash` says when it is safe\n --> sql/models/staging/stg_orders.sql:26:3\n |\n 26 | HASH(status) AS status_hash\n | ^^^^^^^^^^^^ DuckDB computes its own hash, never Snowflake's\n\nerror[SBL0002]: fn:IS_DOUBLE has no DuckDB equivalent 1 test · 1 model\n = help: run these tests on the warehouse with --run-on auto\n --> sql/models/staging/stg_orders.sql:40:3\n |\n 40 | IS_DOUBLE(payload) AS is_number\n | ^^^^^^^^^^^^^^^^^ no rule converts this function\n\nerror: missing rule 1 test\n └── node:method_call 1 test test_fact_orders\n = note: no rule converts METHOD CALL\n = help: run these tests on the warehouse with --run-on auto\n", }, RenderTestCase { description: "--run-on local at 160 columns", decisions: vec![ refused("test_stg_orders", "fn:HASH", 26), refused("test_daily_revenue_chain", "fn:HASH", 26), - refused_with_code("test_customers", "fn:IS_DOUBLE", "SQ0002"), + refused_with_code("test_customers", "fn:IS_DOUBLE", "SBL0002"), unplaced("test_fact_orders"), ], errors: true, verbose: false, columns: 160, - expected_text: "\nCan't run locally (4 tests):\n\nerror[SQ0008]: HASH gives a different value in DuckDB 2 tests · 1 model\n = note: Equal inputs still get equal hashes within one run.\n = help: allow it for local tests in sqlbuild_project.toml with\n `[testing.local] allow = { hash = true }`; `sqlquack explain hash` says when it is safe\n --> sql/models/staging/stg_orders.sql:26:3\n |\n 26 | HASH(status) AS status_hash\n | ^^^^^^^^^^^^ DuckDB computes its own hash, never Snowflake's\n\nerror[SQ0002]: fn:IS_DOUBLE has no DuckDB equivalent 1 test · 1 model\n = help: run these tests on the warehouse with --run-on auto\n --> sql/models/staging/stg_orders.sql:40:3\n |\n 40 | IS_DOUBLE(payload) AS is_number\n | ^^^^^^^^^^^^^^^^^ no rule converts this function\n\nerror: missing rule 1 test\n └── node:method_call 1 test test_fact_orders\n = note: no rule converts METHOD CALL\n = help: run these tests on the warehouse with --run-on auto\n", + expected_text: "\nCan't run locally (4 tests):\n\nerror[SBL0008]: HASH gives a different value in DuckDB 2 tests · 1 model\n = note: Equal inputs still get equal hashes within one run.\n = help: allow it for local tests in sqlbuild_project.toml with\n `[testing.local] allow = { hash = true }`; `sqlbabel explain hash` says when it is safe\n --> sql/models/staging/stg_orders.sql:26:3\n |\n 26 | HASH(status) AS status_hash\n | ^^^^^^^^^^^^ DuckDB computes its own hash, never Snowflake's\n\nerror[SBL0002]: fn:IS_DOUBLE has no DuckDB equivalent 1 test · 1 model\n = help: run these tests on the warehouse with --run-on auto\n --> sql/models/staging/stg_orders.sql:40:3\n |\n 40 | IS_DOUBLE(payload) AS is_number\n | ^^^^^^^^^^^^^^^^^ no rule converts this function\n\nerror: missing rule 1 test\n └── node:method_call 1 test test_fact_orders\n = note: no rule converts METHOD CALL\n = help: run these tests on the warehouse with --run-on auto\n", }, RenderTestCase { description: "auto --verbose: the tests run on the warehouse, so each cause is a note", @@ -212,7 +212,7 @@ fn given_refusals_when_rendering_report_then_groups_by_cause_and_lists_origins() errors: false, verbose: true, columns: 80, - expected_text: "\nOn the warehouse (2 tests):\n\nnote[SQ0008]: HASH gives a different value in DuckDB 1 test · 1 model\n = note: Equal inputs still get equal hashes within one run.\n = help: allow it for local tests in sqlbuild_project.toml with\n `[testing.local] allow = { hash = true }`; `sqlquack explain hash` says when it is safe\n --> sql/models/staging/stg_orders.sql:26:3\n |\n 26 | HASH(status) AS status_hash\n | ^^^^^^^^^^^^ DuckDB computes its own hash, never Snowflake's\n\nnote: missing rule 1 test\n └── node:method_call 1 test test_fact_orders\n = note: no rule converts METHOD CALL\n", + expected_text: "\nOn the warehouse (2 tests):\n\nnote[SBL0008]: HASH gives a different value in DuckDB 1 test · 1 model\n = note: Equal inputs still get equal hashes within one run.\n = help: allow it for local tests in sqlbuild_project.toml with\n `[testing.local] allow = { hash = true }`; `sqlbabel explain hash` says when it is safe\n --> sql/models/staging/stg_orders.sql:26:3\n |\n 26 | HASH(status) AS status_hash\n | ^^^^^^^^^^^^ DuckDB computes its own hash, never Snowflake's\n\nnote: missing rule 1 test\n └── node:method_call 1 test test_fact_orders\n = note: no rule converts METHOD CALL\n", }, RenderTestCase { description: "two places of one cause are one group with both frames", @@ -223,7 +223,7 @@ fn given_refusals_when_rendering_report_then_groups_by_cause_and_lists_origins() errors: true, verbose: false, columns: 80, - expected_text: "\nCan't run locally (2 tests):\n\nerror[SQ0008]: HASH gives a different value in DuckDB\n 2 tests · 1 model · 2 places\n = note: Equal inputs still get equal hashes within one run.\n = help: allow it for local tests in sqlbuild_project.toml with\n `[testing.local] allow = { hash = true }`; `sqlquack explain hash` says when it is safe\n\n 1. stg_orders 1 test\n --> sql/models/staging/stg_orders.sql:26:3\n |\n 26 | HASH(status) AS status_hash\n | ^^^^^^^^^^^^ DuckDB computes its own hash, never Snowflake's\n\n 2. stg_orders 1 test\n --> sql/models/staging/stg_orders.sql:31:3\n |\n 31 | HASH(status) AS status_hash\n | ^^^^^^^^^^^^ DuckDB computes its own hash, never Snowflake's\n", + expected_text: "\nCan't run locally (2 tests):\n\nerror[SBL0008]: HASH gives a different value in DuckDB\n 2 tests · 1 model · 2 places\n = note: Equal inputs still get equal hashes within one run.\n = help: allow it for local tests in sqlbuild_project.toml with\n `[testing.local] allow = { hash = true }`; `sqlbabel explain hash` says when it is safe\n\n 1. stg_orders 1 test\n --> sql/models/staging/stg_orders.sql:26:3\n |\n 26 | HASH(status) AS status_hash\n | ^^^^^^^^^^^^ DuckDB computes its own hash, never Snowflake's\n\n 2. stg_orders 1 test\n --> sql/models/staging/stg_orders.sql:31:3\n |\n 31 | HASH(status) AS status_hash\n | ^^^^^^^^^^^^ DuckDB computes its own hash, never Snowflake's\n", }, ]; for test_case in test_cases { @@ -284,7 +284,7 @@ fn given_decisions_when_adding_json_then_marks_checks_and_lists_refusals_with_te {"name": "c", "run_on": "warehouse", "run_on_reason": "a known difference that isn't allowed: fn:HASH"}, ]), expected_summary: json!({"total_count": 2, "local_count": 1, "warehouse_count": 2}), - expected_refusals: json!([{"tests": ["b", "c"], "code": "SQ0008", "line": 26}]), + expected_refusals: json!([{"tests": ["b", "c"], "code": "SBL0008", "line": 26}]), }]; for test_case in test_cases { let document = run_on_document(&test_case.decisions); @@ -314,7 +314,7 @@ fn given_runner_json_when_reading_decisions_then_keeps_refusal_fields() { description: "a refusal keeps its label and width", runner_json: r#"{"decisions": [{"name": "a", "run_on": "warehouse", "refusals": [ {"category": "missing rule", "construct": "fn:FLATTEN", "reason": "r", - "code": "SQ0002", "line": 3, "column": 5, "width": 7, "notes": ["n"]}]}]}"#, + "code": "SBL0002", "line": 3, "column": 5, "width": 7, "notes": ["n"]}]}]}"#, expected_decisions: Some(vec![(Some("missing rule: fn:FLATTEN".to_owned()), 7)]), }, ReadTestCase { @@ -342,7 +342,7 @@ fn given_refusal_in_macro_when_rendering_then_frames_the_macro_source_or_the_cal errors: true, verbose: false, columns: 80, - expected_text: "\nCan't run locally (1 test):\n\nerror[SQ0008]: HASH gives a different value in DuckDB 1 test · 1 model\n = note: Equal inputs still get equal hashes within one run.\n = help: allow it for local tests in sqlbuild_project.toml with\n `[testing.local] allow = { hash = true }`; `sqlquack explain hash` says when it is safe\n --> sql/macros/status_hash.sql:3:5\n |\n 3 | HASH(status)\n | ^^^^^^^^^^^^ DuckDB computes its own hash, never Snowflake's\n = used by 1 model:\n stg_orders (1)\n", + expected_text: "\nCan't run locally (1 test):\n\nerror[SBL0008]: HASH gives a different value in DuckDB 1 test · 1 model\n = note: Equal inputs still get equal hashes within one run.\n = help: allow it for local tests in sqlbuild_project.toml with\n `[testing.local] allow = { hash = true }`; `sqlbabel explain hash` says when it is safe\n --> sql/macros/status_hash.sql:3:5\n |\n 3 | HASH(status)\n | ^^^^^^^^^^^^ DuckDB computes its own hash, never Snowflake's\n = used by 1 model:\n stg_orders (1)\n", }, RenderTestCase { description: "the construct isn't in the macro's file, so the call site is framed", @@ -350,7 +350,7 @@ fn given_refusal_in_macro_when_rendering_then_frames_the_macro_source_or_the_cal errors: true, verbose: false, columns: 80, - expected_text: "\nCan't run locally (1 test):\n\nerror[SQ0008]: HASH gives a different value in DuckDB 1 test · 1 model\n = note: Equal inputs still get equal hashes within one run.\n = help: allow it for local tests in sqlbuild_project.toml with\n `[testing.local] allow = { hash = true }`; `sqlquack explain hash` says when it is safe\n --> sql/models/staging/stg_orders.sql:12:5\n |\n 12 | status, HASH(status) AS status_hash\n | ^^^^^^^^^^^^ DuckDB computes its own hash, never Snowflake's\n = expanded from @py.status_hash at sql/models/staging/stg_orders.sql:12:5\n", + expected_text: "\nCan't run locally (1 test):\n\nerror[SBL0008]: HASH gives a different value in DuckDB 1 test · 1 model\n = note: Equal inputs still get equal hashes within one run.\n = help: allow it for local tests in sqlbuild_project.toml with\n `[testing.local] allow = { hash = true }`; `sqlbabel explain hash` says when it is safe\n --> sql/models/staging/stg_orders.sql:12:5\n |\n 12 | status, HASH(status) AS status_hash\n | ^^^^^^^^^^^^ DuckDB computes its own hash, never Snowflake's\n = expanded from @py.status_hash at sql/models/staging/stg_orders.sql:12:5\n", }, ]; for test_case in test_cases { @@ -367,7 +367,7 @@ fn given_refusal_in_macro_when_rendering_then_frames_the_macro_source_or_the_cal #[test] fn given_a_local_test_refused_while_running_when_applied_then_auto_moves_it_and_local_keeps_it() { let guard = LocalRefusal { - category: "SQLQuack guard".to_owned(), + category: "SQLBabel guard".to_owned(), construct: "array_agg_order".to_owned(), reason: "ARRAY_AGG of several values in no defined order".to_owned(), width: 1, @@ -399,7 +399,7 @@ fn given_a_local_test_refused_while_running_when_applied_then_auto_moves_it_and_ let mut decisions = vec![local("test_orders"), local("test_customers")]; let fields = [ ("test", "test_orders"), - ("category", "SQLQuack guard"), + ("category", "SQLBabel guard"), ("construct", "array_agg_order"), ("reason", "ARRAY_AGG of several values in no defined order"), ]; @@ -583,7 +583,7 @@ fn given_many_causes_when_reporting_in_full_then_every_cause_shows_and_shared_no description: "about thirty causes in full at 100 columns", decisions: many_causes(), expected_causes: (0..20) - .map(|index| format!("SQLQuack can't convert FN_{index:02} for these types")) + .map(|index| format!("SQLBabel can't convert FN_{index:02} for these types")) .chain((0..6).map(|index| format!("FN_GAP_{index} has no DuckDB equivalent"))) .collect(), expected_once: &["a Snowflake TIMESTAMP_TZ stores each value's own UTC offset"], @@ -642,7 +642,7 @@ fn given_a_refusals_file_when_reporting_local_refusals_then_it_holds_them_or_a_n project: "unwritable", prepare: |root| std::fs::write(root, "not a directory"), expected_fragments: &[ - "SQLQuack can't convert FN_00 for these types", + "SQLBabel can't convert FN_00 for these types", "note: couldn't write target/test-refusals.txt: ", ], expected_file: false, diff --git a/crates/sqlbuild-core/src/run_output/models.rs b/crates/sqlbuild-core/src/run_output/models.rs index c85b4ffc05..c4285e02cc 100644 --- a/crates/sqlbuild-core/src/run_output/models.rs +++ b/crates/sqlbuild-core/src/run_output/models.rs @@ -112,7 +112,7 @@ pub struct HeaderCause { /// `fn:HASH`, or `project function`. pub label: String, pub count: usize, - /// `SQ0008 · 12 models`. + /// `SBL0008 · 12 models`. pub detail: String, } diff --git a/crates/sqlbuild-core/src/run_output/tests/helpers.rs b/crates/sqlbuild-core/src/run_output/tests/helpers.rs index fb303d0c2b..323248ee51 100644 --- a/crates/sqlbuild-core/src/run_output/tests/helpers.rs +++ b/crates/sqlbuild-core/src/run_output/tests/helpers.rs @@ -84,7 +84,7 @@ pub(super) fn causes(count: usize) -> Vec { .map(|index| HeaderCause { label: format!("fn:FUNCTION_{index}"), count: 6 - index.min(5), - detail: "SQ0002 \u{b7} 1 model".to_owned(), + detail: "SBL0002 \u{b7} 1 model".to_owned(), }) .collect() } diff --git a/crates/sqlbuild-core/src/run_output/tests/test_run_output.rs b/crates/sqlbuild-core/src/run_output/tests/test_run_output.rs index 707ca38936..5c4cc37593 100644 --- a/crates/sqlbuild-core/src/run_output/tests/test_run_output.rs +++ b/crates/sqlbuild-core/src/run_output/tests/test_run_output.rs @@ -250,7 +250,7 @@ fn given_run_on_split_when_rendering_header_then_explains_what_cant_run_locally( description: "--run-on local draws the tree and caps the causes", header: header(causes(6), (19, 0, 21), true), columns: 80, - expected_text: "Tests ready 40 selected, 19 local, 21 can't run locally\n\nRun on (40)\n├── local 19 DuckDB\n└── can't run locally 21 6 causes, listed after the run\n ├── fn:FUNCTION_0 6 SQ0002 · 1 model\n ├── fn:FUNCTION_1 5 SQ0002 · 1 model\n ├── fn:FUNCTION_2 4 SQ0002 · 1 model\n ├── fn:FUNCTION_3 3 SQ0002 · 1 model\n ├── fn:FUNCTION_4 2 SQ0002 · 1 model\n └── ... and 1 more\n", + expected_text: "Tests ready 40 selected, 19 local, 21 can't run locally\n\nRun on (40)\n├── local 19 DuckDB\n└── can't run locally 21 6 causes, listed after the run\n ├── fn:FUNCTION_0 6 SBL0002 · 1 model\n ├── fn:FUNCTION_1 5 SBL0002 · 1 model\n ├── fn:FUNCTION_2 4 SBL0002 · 1 model\n ├── fn:FUNCTION_3 3 SBL0002 · 1 model\n ├── fn:FUNCTION_4 2 SBL0002 · 1 model\n └── ... and 1 more\n", }, HeaderTestCase { description: "auto at 80 columns wraps the note", diff --git a/crates/sqlbuild-python-base/src/native_host/constants.rs b/crates/sqlbuild-python-base/src/native_host/constants.rs index 4865024857..15c69daf12 100644 --- a/crates/sqlbuild-python-base/src/native_host/constants.rs +++ b/crates/sqlbuild-python-base/src/native_host/constants.rs @@ -58,5 +58,5 @@ pub(crate) const CONNECT_METHOD: &str = "connect"; /// `ABANDONABLE_THREAD_PREFIX` of the discovered item pool, which names its threads with it. pub(crate) const STEP_THREAD_PREFIX: &str = "sqlbuild-item"; -/// The warehouse dialect whose tests SQLQuack converts to run in the local DuckDB. +/// The warehouse dialect whose tests SQLBabel converts to run in the local DuckDB. pub const CONVERTED_DIALECT: &str = "snowflake"; diff --git a/crates/sqlbuild-python-front/src/compile_driver/_helpers/local_tests.rs b/crates/sqlbuild-python-front/src/compile_driver/_helpers/local_tests.rs index d885a3b3c4..da7e266eab 100644 --- a/crates/sqlbuild-python-front/src/compile_driver/_helpers/local_tests.rs +++ b/crates/sqlbuild-python-front/src/compile_driver/_helpers/local_tests.rs @@ -1,4 +1,4 @@ -//! `[testing.local] allow` and `tests/overrides`: refused outside Snowflake projects, checked by SQLQuack in them. +//! `[testing.local] allow` and `tests/overrides`: refused outside Snowflake projects, checked by SQLBabel in them. use std::path::PathBuf; @@ -14,7 +14,7 @@ use crate::compile_driver::models::ProjectConfiguration; use crate::contracts::main::resolve_effective_adapter_name::resolve_effective_adapter_name; use crate::native_host::main::local_test_inputs_problem::local_test_inputs_problem; -/// Refuse local test allowances outside a Snowflake project, and what SQLQuack can't use in one. +/// Refuse local test allowances outside a Snowflake project, and what SQLBabel can't use in one. pub(crate) fn reject_invalid_local_test_inputs( config: &ProjectConfiguration<'_, '_>, ) -> PyResult<()> { @@ -29,7 +29,7 @@ pub(crate) fn reject_invalid_local_test_inputs( py, ErrorId::ProjectConfig, &format!( - "[testing.local] allow in sqlbuild_project.toml allows SQLQuack known \ + "[testing.local] allow in sqlbuild_project.toml allows SQLBabel known \ differences when local tests convert Snowflake SQL, and this is a {adapter} \ project" ), diff --git a/crates/sqlbuild-python-front/src/compile_driver/constants.rs b/crates/sqlbuild-python-front/src/compile_driver/constants.rs index 56d5c82176..7f12eb7169 100644 --- a/crates/sqlbuild-python-front/src/compile_driver/constants.rs +++ b/crates/sqlbuild-python-front/src/compile_driver/constants.rs @@ -4,7 +4,7 @@ pub(crate) const LOADER_TARGET: &str = "default"; /// The target's `loader_schema` when the target has no default schema; each run names its own `destination_schema`. pub(crate) const LOADER_SCHEMA: &str = "main"; -/// Where a project keeps the SQLQuack overrides its local tests use. +/// Where a project keeps the SQLBabel overrides its local tests use. pub(crate) const LOCAL_OVERRIDES_DIR: &str = "tests/overrides"; /// The `@loader` option that makes SQLLoad write a loader's rows; without it a loader that fills a source writes its own table. pub(crate) const WRITE_STRATEGY_KEY: &str = "write_strategy"; diff --git a/crates/sqlbuild-python-front/src/native_host/main/local_test_inputs_problem.rs b/crates/sqlbuild-python-front/src/native_host/main/local_test_inputs_problem.rs index e593c4b6a6..c923b68d20 100644 --- a/crates/sqlbuild-python-front/src/native_host/main/local_test_inputs_problem.rs +++ b/crates/sqlbuild-python-front/src/native_host/main/local_test_inputs_problem.rs @@ -1,11 +1,11 @@ -//! Why SQLQuack can't use a project's local test allowances or overrides, as the executor host checks. +//! Why SQLBabel can't use a project's local test allowances or overrides, as the executor host checks. use pyo3::prelude::{Bound, PyAny, PyAnyMethods, PyResult, Python}; use sqlbuild_host::entries::models::ExecutorHost; use sqlbuild_python_base::boundary::main::call_with::call_with; use sqlbuild_python_base::native_host::main::host_entry::host_entry; -/// The problem SQLQuack finds with `allow` or the overrides under `project_dir`; `None` when it finds none. +/// The problem SQLBabel finds with `allow` or the overrides under `project_dir`; `None` when it finds none. pub fn local_test_inputs_problem( project_dir: &Bound<'_, PyAny>, allow: &Bound<'_, PyAny>, diff --git a/pyproject.toml b/pyproject.toml index 3a8c28bc8f..b3ef844ec7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,7 @@ dependencies = [ "PyYAML>=6.0.2", "sqlbuild-cli==0.275.2", # x-release-please-version "sqlload-api==0.89.1", - "sqlquack==0.25.0", + "sqlbabel==0.39.0", ] [project.optional-dependencies] diff --git a/src/sqlbuild/.agents/skills/sqlbuild/references/docs/cli/scenario.md b/src/sqlbuild/.agents/skills/sqlbuild/references/docs/cli/scenario.md index 338fcad6c8..7959de2dad 100644 --- a/src/sqlbuild/.agents/skills/sqlbuild/references/docs/cli/scenario.md +++ b/src/sqlbuild/.agents/skills/sqlbuild/references/docs/cli/scenario.md @@ -103,8 +103,8 @@ sqb scenario test --select revenue | `--run-on` | Where each scenario runs | |------|-------------| -| `auto` (default) | Locally when its snapshot is fresh and SQLQuack converts all its SQL; otherwise on the warehouse | -| `local` | Locally. A scenario with a missing or stale snapshot, or SQL SQLQuack refuses, is not run and fails the run; nothing goes to the warehouse | +| `auto` (default) | Locally when its snapshot is fresh and SQLBabel converts all its SQL; otherwise on the warehouse | +| `local` | Locally. A scenario with a missing or stale snapshot, or SQL SQLBabel refuses, is not run and fails the run; nothing goes to the warehouse | | `warehouse` | On the warehouse | The setting comes from, in order: `--run-on`, the default target's `scenario_run_on`, @@ -187,9 +187,9 @@ Fix in your SQL (1 scenario): The header and the grouped causes work as for [`sqb test`](test.md#local-and-warehouse-runs): under `--run-on local` a `Run on` tree and a `Can't run locally (N scenarios):` summary after the failures, with the full report in `target/scenario-refusals.txt`; in `auto` a `note:` line in the header, `--explain` for where each cause is, and -`--verbose` for the full notes after the run. A scenario whose converted SQL hits a SQLQuack guard +`--verbose` for the full notes after the run. A scenario whose converted SQL hits a SQLBabel guard or a DuckDB internal error while it replays runs again on the warehouse in `auto`, with the -reason `SQLQuack guard: ` or `DuckDB internal error: `, and its local attempt +reason `SQLBabel guard: ` or `DuckDB internal error: `, and its local attempt prints nothing; with `--run-on local` it is not run. With `--json`, each scenario has `run_on` and `run_on_reason`, `summary` has `local_count` and `warehouse_count`, and the document has `refusals`, as for `sqb test`. diff --git a/src/sqlbuild/.agents/skills/sqlbuild/references/docs/cli/test.md b/src/sqlbuild/.agents/skills/sqlbuild/references/docs/cli/test.md index 8cdc2f11d2..6ec37de19e 100644 --- a/src/sqlbuild/.agents/skills/sqlbuild/references/docs/cli/test.md +++ b/src/sqlbuild/.agents/skills/sqlbuild/references/docs/cli/test.md @@ -146,9 +146,9 @@ On the warehouse (3 tests) [ 1] project function customer_orders ``` -A test that hits a SQLQuack guard or a DuckDB internal error while it runs locally runs again on +A test that hits a SQLBabel guard or a DuckDB internal error while it runs locally runs again on the warehouse in `auto`, and a `note:` line after the rows says how many moved and why. -`--verbose` prints the full diagnostics after the run, as notes (`note[SQ0008]`), since these +`--verbose` prints the full diagnostics after the run, as notes (`note[SBL0008]`), since these tests still ran. With `--run-on local`, a test DuckDB can't run as the warehouse would is not run. The header @@ -160,7 +160,7 @@ Tests ready 40 selected, 37 local, 3 can't run locally Run on (40) ├── local 37 DuckDB └── can't run locally 3 2 causes, listed after the run - ├── fn:HASH 2 SQ0008 · 2 models + ├── fn:HASH 2 SBL0008 · 2 models └── project function 1 ``` @@ -176,19 +176,19 @@ per cause with its tests, models and places, grouped by who can act on it: Can't run locally (40 tests): Fix in your SQL (31 tests): - SQ0003 SQLQuack can't convert DATEDIFF for these types 8 tests · 8 models · 8 places [1] - SQ0003 SQLQuack can't convert TO_VARCHAR for these types 6 tests · 6 models · 6 places [2] + SBL0003 SQLBabel can't convert DATEDIFF for these types 8 tests · 8 models · 8 places [1] + SBL0003 SQLBabel can't convert TO_VARCHAR for these types 6 tests · 6 models · 6 places [2] +12 more causes · 17 tests [1] convert the value to a wall time first: `CONVERT_TIMEZONE('UTC', col)::TIMESTAMP_NTZ` [2] the label names the operand types this function covers; cast the operand to one of them Allow a known difference (2 tests): - SQ0008 HASH gives a different value in DuckDB 2 tests · 2 models [3] + SBL0008 HASH gives a different value in DuckDB 2 tests · 2 models [3] [3] allow it for local tests in sqlbuild_project.toml with `[testing.local] allow = { hash = true }` Tool gaps (7 tests): - SQLQuack guard: json_fidelity, float_text +1 5 tests - SQ0002 SQLQuack can't convert IS_DOUBLE yet 2 tests · 1 model + SQLBabel guard: json_fidelity, float_text +1 5 tests + SBL0002 SQLBabel can't convert IS_DOUBLE yet 2 tests · 1 model Every cause in full: target/test-refusals.txt or --verbose; every test: --json (refusals[].tests). ``` @@ -197,7 +197,7 @@ Tool gaps (7 tests): | --- | --- | | Fix in your SQL | A change to the project's SQL lets the test run locally; the help says which | | Allow a known difference | A difference DuckDB has from Snowflake that `[testing.local] allow` can accept | -| Tool gaps | A construct SQLQuack or SQLBuild doesn't run locally yet | +| Tool gaps | A construct SQLBabel or SQLBuild doesn't run locally yet | | Internal errors | DuckDB failing on converted SQL, or a construct only SQLBuild's generated comparison holds; shown in full | Each help prints once, as a numbered note that every row sharing it points to. A section lists @@ -214,7 +214,7 @@ reads `as for above`. A run without refusals removes the file. With `--json`, each check has `run_on` (`local` or `warehouse`) and `run_on_reason` (the first refusal's `: `, or `null`), `summary` has `local_count` and `warehouse_count`, and the document has `refusals`: each refusal once per construct and place, -with SQLQuack's `code`, `category`, `construct`, `reason`, `message`, `label`, `notes` and +with SQLBabel's `code`, `category`, `construct`, `reason`, `message`, `label`, `notes` and `help`, its `path`, `line` and `column` (`line` and `column` are `null` when only the file is known), `generated` (`true` when only SQLBuild's generated comparison holds the construct), its `title` (`: `), and `tests`, the tests it blocks. diff --git a/src/sqlbuild/.agents/skills/sqlbuild/references/docs/concepts/project-configuration.md b/src/sqlbuild/.agents/skills/sqlbuild/references/docs/concepts/project-configuration.md index 66ea24a89a..9b6daf6bf3 100644 --- a/src/sqlbuild/.agents/skills/sqlbuild/references/docs/concepts/project-configuration.md +++ b/src/sqlbuild/.agents/skills/sqlbuild/references/docs/concepts/project-configuration.md @@ -729,7 +729,7 @@ delta_compile = true | `unit_test_max_real_models` | `10` | Most real (unmocked) models one SQL unit test may execute; a larger test fails compilation. See [Unit test and scenario limits](#unit-test-and-scenario-limits). | | `test_timeout` | `30s` | Time limit for each SQL unit test, or `"disabled"` | | `scenario_timeout` | none | Time limit for each scenario, or `"disabled"` | -| `test_run_on` | `auto` | Where `sqb test` runs unit tests: `auto` (locally in DuckDB when SQLQuack converts a test, otherwise on the warehouse), `local` or `warehouse`. See [Running tests locally](testing-reference.md#running-tests-locally) | +| `test_run_on` | `auto` | Where `sqb test` runs unit tests: `auto` (locally in DuckDB when SQLBabel converts a test, otherwise on the warehouse), `local` or `warehouse`. See [Running tests locally](testing-reference.md#running-tests-locally) | | `scenario_run_on` | `auto` | Where `sqb scenario test` runs scenarios: `auto` (locally with a fresh snapshot whose SQL converts, otherwise on the warehouse), `local` or `warehouse`. See [Local scenario testing](scenarios.md#local-scenario-testing) | | `delta_compile` | `true` | After an edit to model SQL or SQL test files only, compile just the changed files against the previous compile. See [Compiling after an edit](../cli/compile.md#compiling-after-an-edit). | | `allow_missing_secrets` | `false` | Let `compile`, `rules run`, `format`, `dag`, `lineage` and `scope` run without any provider's secrets on this machine. `sqlbuild_local.toml` only; a target lists the providers it expects to miss in [`[targets.] allow_missing_secrets`](#allowed-missing-secrets). See [Secrets](python-nodes/providers.md#allowing-missing-secrets). | @@ -927,7 +927,7 @@ See [Scenarios](scenarios.md) for details on local type overrides and capture li ## Testing -The SQLQuack known differences that local unit tests may rely on, by name: +The SQLBabel known differences that local unit tests may rely on, by name: ```toml [testing.local] @@ -1097,7 +1097,7 @@ Python is supported only under `python/`, `rules/`, `orchestration/`, `sql/hooks The project's `tests/` directory holds SQL tests and scenarios, and pytest tests of project Python under `tests/python/nodes/`, `tests/python/providers/` and `tests/orchestration/`, which `sqb test` -runs; see [Python tests](../cli/test.md#python-tests). `tests/overrides/` holds the SQLQuack +runs; see [Python tests](../cli/test.md#python-tests). `tests/overrides/` holds the SQLBabel overrides local unit tests use; see [Allowing known differences and overrides](testing-reference.md#allowing-known-differences-and-overrides). Orchestrator code such as Dagster or Rivers definitions lives outside the SQLBuild project directory and points at it; see diff --git a/src/sqlbuild/.agents/skills/sqlbuild/references/docs/concepts/scenarios.md b/src/sqlbuild/.agents/skills/sqlbuild/references/docs/concepts/scenarios.md index 24b3e57d4e..fd4861e619 100644 --- a/src/sqlbuild/.agents/skills/sqlbuild/references/docs/concepts/scenarios.md +++ b/src/sqlbuild/.agents/skills/sqlbuild/references/docs/concepts/scenarios.md @@ -329,7 +329,7 @@ Run scenarios locally against DuckDB: sqb scenario test --run-on local ``` -By default (`auto`), a scenario replays locally when its snapshot is fresh and SQLQuack converts +By default (`auto`), a scenario replays locally when its snapshot is fresh and SQLBabel converts all of its SQL, and runs on the warehouse otherwise. With `--run-on local`, every scenario replays locally, and one that cannot is not run and fails the run. Set the default with `[settings] scenario_run_on` or a target's `scenario_run_on`; see [`sqb scenario test`](../cli/scenario.md#where-scenarios-run). @@ -339,7 +339,7 @@ Local replay: 1. Checks snapshot freshness via the input fingerprint; a missing or stale snapshot keeps the scenario off DuckDB 2. Creates a temporary DuckDB database at `target/run/scenarios//local.duckdb` 3. Loads JSONL snapshots into typed DuckDB tables using column metadata from `scenario.json` -4. Converts function, model and check SQL from Snowflake to DuckDB with [SQLQuack](https://github.com/sqlstack-io/sqlquack), in a UTC session, reading the snapshot columns' captured types and models' declared column types; SQL captured from a DuckDB project runs as authored, and other adapters' scenarios run on the warehouse +4. Converts function, model and check SQL from Snowflake to DuckDB with [SQLBabel](https://github.com/sqlstack-io/sqlbabel), in a UTC session, reading the snapshot columns' captured types and models' declared column types; SQL captured from a DuckDB project runs as authored, and other adapters' scenarios run on the warehouse 5. Builds functions, models, and runs expected/assertion checks in DuckDB 6. Keeps the local DuckDB file for inspection (it lives under `target/`, so it's always retained) @@ -394,5 +394,5 @@ See the [CLI reference](../cli/scenario.md) for full command documentation. order, whitespace and number spelling do not matter, so a Snowflake capture's pretty-printed JSON equals an expected `PARSE_JSON(...)`. Values of non-JSON types with the same JSON text also compare equal, for example `DATE '2024-01-01'::VARIANT` and `'2024-01-01'::VARIANT`. -- Local replay runs only SQL SQLQuack converts. A model read by another model needs fully typed declared columns, or SQLQuack refuses the reading SQL (`unresolved name`) and the scenario runs on the warehouse. +- Local replay runs only SQL SQLBabel converts. A model read by another model needs fully typed declared columns, or SQLBabel refuses the reading SQL (`unresolved name`) and the scenario runs on the warehouse. - Outside local replay, scenario fixture, expected and assertion SQL runs as authored: SQLBuild replaces `__ref`, `__source`, `__seed` and `__dbt_ref` calls with relation names and may wrap a partial fixture to add its missing columns, but never regenerates the query. Calls inside comments and quoted text are left unchanged. Quoted text and comments follow the project adapter's rules, including in local replay: backslash escapes on Snowflake, BigQuery and Databricks, `E'...'` strings on DuckDB and Postgres, nested block comments on DuckDB, Postgres, Databricks and SQL Server, `#` line comments on BigQuery, and `//` line comments on Snowflake. A call naming a relation the scenario does not provide, or SQL with an unclosed string or comment, fails planning with `S511` naming the scenario file. diff --git a/src/sqlbuild/.agents/skills/sqlbuild/references/docs/concepts/testing-reference.md b/src/sqlbuild/.agents/skills/sqlbuild/references/docs/concepts/testing-reference.md index 1888cdfe49..a517825cd0 100644 --- a/src/sqlbuild/.agents/skills/sqlbuild/references/docs/concepts/testing-reference.md +++ b/src/sqlbuild/.agents/skills/sqlbuild/references/docs/concepts/testing-reference.md @@ -441,8 +441,8 @@ credentials. | Setting | Where each test runs | | --- | --- | -| `auto` (default) | Locally when [SQLQuack](https://github.com/sqlstack-io/sqlquack) converts its comparison SQL to DuckDB, otherwise on the warehouse | -| `local` | Locally. A test SQLQuack refuses is not run (`NOT_RUN=`, `T007` in `--json`), and `sqb test` exits `2` when no test failed; it is never sent to the warehouse | +| `auto` (default) | Locally when [SQLBabel](https://github.com/sqlstack-io/sqlbabel) converts its comparison SQL to DuckDB, otherwise on the warehouse | +| `local` | Locally. A test SQLBabel refuses is not run (`NOT_RUN=`, `T007` in `--json`), and `sqb test` exits `2` when no test failed; it is never sent to the warehouse | | `warehouse` | On the warehouse, as every test ran before | The setting comes from, in order: `--run-on`, the selected target's `test_run_on` (a target in @@ -459,31 +459,31 @@ test_run_on = "local" How SQLBuild decides, at compile time, before anything runs: -- **Snowflake projects.** SQLQuack converts the test's comparison SQL: every real model in its - chain, its fixtures, expected rows and assertions. SQLQuack converts only constructs whose rules +- **Snowflake projects.** SQLBabel converts the test's comparison SQL: every real model in its + chain, its fixtures, expected rows and assertions. SQLBabel converts only constructs whose rules were verified against recorded Snowflake results, and refuses anything else. SQLBuild gives - SQLQuack the declared columns of the project's sources, seeds and models. + SQLBabel the declared columns of the project's sources, seeds and models. - **DuckDB projects.** The SQL is already DuckDB SQL, so tests run locally as written. - **Project functions.** A local run makes temporary copies of the functions a test calls. A function whose body reads a table or view, or any function in a project that isn't DuckDB, needs the warehouse (reason `project function: `). - **Unmocked relations.** A test whose SQL still reads a relation the local database doesn't have, rather than one of its fixtures, needs the warehouse (reason `warehouse relation: `). In a - Snowflake project SQLQuack refuses names the project doesn't declare, and a declared relation the + Snowflake project SQLBabel refuses names the project doesn't declare, and a declared relation the converted SQL reads by name, such as a table a model names directly, is one only the warehouse has. - **Work per run.** Each distinct test statement is converted once, in worker processes, and the - test run reuses those conversions. Conversions are kept in `target/sqlquack-cache/`, keyed by the - SQL, the declared relations it reads, the session and the SQLQuack version, so a later run + test run reuses those conversions. Conversions are kept in `target/sqlbabel-cache/`, keyed by the + SQL, the declared relations it reads, the session and the SQLBabel version, so a later run converts only the statements that changed. At the end of a run, SQLBuild deletes the conversions no run has used for 7 days. Deleting the folder is always safe. -- **Other adapters.** SQLQuack converts Snowflake SQL only, so tests run on the warehouse (reason +- **Other adapters.** SQLBabel converts Snowflake SQL only, so tests run on the warehouse (reason `dialect: `). - **Time zone.** Local runs use a UTC session. When the target's connection sets another - `TIMEZONE` in `session_parameters`, SQLQuack refuses SQL whose result depends on the time zone, + `TIMEZONE` in `session_parameters`, SQLBabel refuses SQL whose result depends on the time zone, and those tests go to the warehouse. `sqb test --inspect` adds one line per test: `runs on: local`, or -`runs on: warehouse ()`, where the reason is SQLQuack's refusal label +`runs on: warehouse ()`, where the reason is SQLBabel's refusal label `: `, such as `missing rule: node:method_call` or `a known difference that isn't allowed: fn:HASH`. The full diagnostics follow the plan. @@ -491,10 +491,10 @@ In `auto`, when the warehouse connection cannot be made, the local tests still r warehouse test is not run (`NOT_RUN=`, `T008` in `--json`), and a `Not run (N): needs the warehouse (no connection)` line says why. -Some problems only show when a test runs. SQLQuack's converted SQL raises, instead of returning a +Some problems only show when a test runs. SQLBabel's converted SQL raises, instead of returning a different value, for inputs DuckDB would read differently from Snowflake, and DuckDB can fail with an internal error on SQL it accepted. In `auto` such a test runs again on the warehouse, with the -reason `SQLQuack guard: `, such as `SQLQuack guard: array_agg_order`, or +reason `SQLBabel guard: `, such as `SQLBabel guard: array_agg_order`, or `DuckDB internal error: `. The local attempt prints nothing; the test's row shows `warehouse`, and a `note:` line after the rows counts the tests that moved and why. With `--run-on local` it is not run, and `Can't run locally` names the guard. An error Snowflake would raise too, such as a value that isn't a number, is the test's @@ -502,7 +502,7 @@ own result wherever it runs. ### Allowing known differences and overrides -In a Snowflake project, a test SQLQuack refuses only because a construct behaves differently in +In a Snowflake project, a test SQLBabel refuses only because a construct behaves differently in DuckDB, such as `HASH`, can still run locally. Allow the known difference for local tests in `sqlbuild_project.toml`: @@ -511,8 +511,8 @@ DuckDB, such as `HASH`, can still run locally. Allow the known difference for lo allow = { hash = true } ``` -Or replace the function for local tests with a SQLQuack override in `tests/overrides/`, one file per -function, in SQLQuack's `FUNCTION()` format: +Or replace the function for local tests with a SQLBabel override in `tests/overrides/`, one file per +function, in SQLBabel's `FUNCTION()` format: ```sql -- tests/overrides/hash.sql @@ -532,13 +532,13 @@ A test that relies on either says so in its row and in `sqb test --inspect`: ``` The refusal's help names the setting: `allow it with hash = true under [testing.local] allow in -sqlbuild_project.toml`. `sqlquack explain ` says when a known difference is safe to allow. +sqlbuild_project.toml`. `sqlbabel explain ` says when a known difference is safe to allow. Details: -- The names are SQLQuack's known-difference names. A name SQLQuack doesn't know fails compile, with +- The names are SQLBabel's known-difference names. A name SQLBabel doesn't know fails compile, with the nearest name it knows. -- Two override files replacing one function, or a file SQLQuack can't read, fail compile, naming +- Two override files replacing one function, or a file SQLBabel can't read, fail compile, naming the files. - Allowances and overrides apply to local runs only. Warehouse tests, builds and deploys never read them. diff --git a/src/sqlbuild/executor/local/__init__.py b/src/sqlbuild/executor/local/__init__.py index 6e0b2f45c2..9c423f0db9 100644 --- a/src/sqlbuild/executor/local/__init__.py +++ b/src/sqlbuild/executor/local/__init__.py @@ -1 +1 @@ -"""Local DuckDB runs of unit tests and scenarios, converted by SQLQuack.""" +"""Local DuckDB runs of unit tests and scenarios, converted by SQLBabel.""" diff --git a/src/sqlbuild/executor/local/_helpers/conversion.py b/src/sqlbuild/executor/local/_helpers/conversion.py index a826ee0888..6ea2ab24f7 100644 --- a/src/sqlbuild/executor/local/_helpers/conversion.py +++ b/src/sqlbuild/executor/local/_helpers/conversion.py @@ -1,4 +1,4 @@ -"""Once per unique SQL: SQLQuack's conversion and the relation an empty DuckDB lacks.""" +"""Once per unique SQL: SQLBabel's conversion and the relation an empty DuckDB lacks.""" from __future__ import annotations @@ -7,21 +7,25 @@ import multiprocessing import os import re +import sys import threading from collections.abc import Mapping, Sequence from concurrent.futures import ProcessPoolExecutor from pathlib import Path from typing import Any -import sqlquack -from sqlquack.api.constants import DEFAULT_PATH +import sqlbabel +from sqlbabel.api.constants import DEFAULT_PATH +from sqlbuild._native import shared_transient_line_coordinator from sqlbuild.errors.contracts.exceptions import ExecutorInputError from sqlbuild.executor.local._helpers.local_inputs import convert_options, relied_on from sqlbuild.executor.local.classes.empty_duckdb import EmptyDuckDb from sqlbuild.executor.local.constants import ( CONVERSION_CACHE_INDEX, CONVERSION_CACHE_LIFETIME_SECONDS, + RETIRED_CONVERSION_CACHE_NAME, + RETIRED_CONVERSION_CACHE_NOTICE, TIMEZONE_PARAMETER, UTC_TIME_ZONE, ) @@ -71,9 +75,11 @@ def inputs(self) -> LocalInputs: with self._lock: return self._inputs - def use_cache_dir(self, directory: Path | None) -> None: + def use_cache_dir(self, directory: Path | None) -> bool: with self._lock: + changed: bool = directory != self._cache_dir self._cache_dir = directory + return changed def cache_dir(self) -> Path | None: with self._lock: @@ -173,9 +179,16 @@ def empty(self) -> EmptyDuckDb: def use_conversion_cache(directory: Path | None) -> None: - """Keep conversions in `directory` across runs, keyed by SQL, schema and SQLQuack version.""" + """Keep conversions in `directory` across runs; note SQLQuack's unread folder beside it.""" - _WORK.use_cache_dir(directory) + if not _WORK.use_cache_dir(directory) or directory is None: + return + retired: Path = directory.with_name(RETIRED_CONVERSION_CACHE_NAME) + if retired.is_dir(): + shared_transient_line_coordinator().write_persistent( + stream=sys.stderr, + text=RETIRED_CONVERSION_CACHE_NOTICE.format(retired=retired, directory=directory), + ) def use_local_inputs(inputs: LocalInputs) -> None: @@ -187,7 +200,7 @@ def use_local_inputs(inputs: LocalInputs) -> None: def converted( *, sql: str, schema: Mapping[str, Any] | None, time_zone: str | None, path: str ) -> ConvertedSql: - """SQLQuack's conversion of `sql`: DuckDB SQL and its macros, or the refusals.""" + """SQLBabel's conversion of `sql`: DuckDB SQL and its macros, or the refusals.""" conversion: ConvertedSql | None = local_check( sql=sql, schema=schema, time_zone=time_zone, path=path @@ -316,12 +329,12 @@ def _session(*, time_zone: str | None) -> dict[str, str]: def _check(*, job: _CheckJob, empty: EmptyDuckDb, path: str) -> LocalSqlCheck: - """Convert Snowflake SQL, whose unknown names SQLQuack refuses; bind DuckDB SQL as authored.""" + """Convert Snowflake SQL, whose unknown names SQLBabel refuses; bind DuckDB SQL as authored.""" sql, schema, session, convert, inputs = job if not convert: return LocalSqlCheck(conversion=None, missing=empty.missing_relation(sql=sql, macros=())) - conversion: Any = sqlquack.convert( + conversion: Any = sqlbabel.convert( sql=sql, options=convert_options(inputs=inputs, schema=schema, session=session), path=path, @@ -349,7 +362,7 @@ def _cache_file(job: _CheckJob) -> Path | None: return None digest: str = hashlib.sha256( json.dumps( - [_CACHE_FORMAT, sqlquack.__version__, sql, schema, session, inputs.digest], + [_CACHE_FORMAT, sqlbabel.__version__, sql, schema, session, inputs.digest], sort_keys=True, ).encode() ).hexdigest() diff --git a/src/sqlbuild/executor/local/_helpers/decisions.py b/src/sqlbuild/executor/local/_helpers/decisions.py index 3938034902..6a14ec2efe 100644 --- a/src/sqlbuild/executor/local/_helpers/decisions.py +++ b/src/sqlbuild/executor/local/_helpers/decisions.py @@ -170,7 +170,7 @@ def _dialect_decision(*, name: str, dialect: str | None) -> RunOnDecision: LocalRefusal( category=DIALECT_REASON_CATEGORY, construct=str(dialect), - reason=f"SQLQuack converts Snowflake SQL only, not {dialect}", + reason=f"SQLBabel converts Snowflake SQL only, not {dialect}", ), ), ) diff --git a/src/sqlbuild/executor/local/_helpers/local_inputs.py b/src/sqlbuild/executor/local/_helpers/local_inputs.py index 0f1027819e..b4a07f9b25 100644 --- a/src/sqlbuild/executor/local/_helpers/local_inputs.py +++ b/src/sqlbuild/executor/local/_helpers/local_inputs.py @@ -1,4 +1,4 @@ -"""A project's SQLQuack allowances and overrides for local tests, and what conversions relied on.""" +"""A project's SQLBabel allowances and overrides for local tests, and what conversions relied on.""" from __future__ import annotations @@ -8,7 +8,7 @@ from pathlib import Path from typing import Any -from sqlquack import ConvertOptions +from sqlbabel import ConvertOptions from sqlbuild.executor.local.constants import ( ALLOWED_LABEL, @@ -48,7 +48,7 @@ def local_inputs(*, project_dir: Path, allow: Mapping[str, bool]) -> LocalInputs def convert_options( *, inputs: LocalInputs, schema: Mapping[str, Any] | None, session: Mapping[str, str] ) -> ConvertOptions: - """SQLQuack's options for local test SQL, with the project's allowances and overrides.""" + """SQLBabel's options for local test SQL, with the project's allowances and overrides.""" return ConvertOptions( no_config=True, diff --git a/src/sqlbuild/executor/local/_helpers/positions.py b/src/sqlbuild/executor/local/_helpers/positions.py index fbf60799e5..3ca293b332 100644 --- a/src/sqlbuild/executor/local/_helpers/positions.py +++ b/src/sqlbuild/executor/local/_helpers/positions.py @@ -15,10 +15,10 @@ CALL_OPEN, COMMENT_PREFIXES, GENERATED_SQL_NOTE, + SQLBABEL_ALLOW_HELP, + SQLBABEL_SOURCES_HELP, SQLBUILD_ALLOW_HELP, SQLBUILD_SOURCES_HELP, - SQLQUACK_ALLOW_HELP, - SQLQUACK_SOURCES_HELP, STATEMENT_CONSTRUCT, ) from sqlbuild.executor.local.models import LocalRefusal, MacroPlace, Segment, TestSources @@ -46,7 +46,7 @@ class _Place: def placed_refusal(*, refusal: Mapping[str, Any], sources: TestSources) -> LocalRefusal: - """One SQLQuack refusal as a diagnostic in the model, test or fixture file that writes it.""" + """One SQLBabel refusal as a diagnostic in the model, test or fixture file that writes it.""" span: Mapping[str, int] | None = refusal.get("span") place: _Place | None = None @@ -87,11 +87,11 @@ def placed_refusal(*, refusal: Mapping[str, Any], sources: TestSources) -> Local def sqlbuild_help(help_text: str) -> str: - """SQLQuack's help with its settings and paths replaced by SQLBuild's.""" + """SQLBabel's help with its settings and paths replaced by SQLBuild's.""" - replaced: str = help_text.replace(SQLQUACK_SOURCES_HELP, SQLBUILD_SOURCES_HELP) + replaced: str = help_text.replace(SQLBABEL_SOURCES_HELP, SQLBUILD_SOURCES_HELP) return re.sub( - SQLQUACK_ALLOW_HELP, + SQLBABEL_ALLOW_HELP, lambda match: SQLBUILD_ALLOW_HELP.format(key=match["key"]), replaced, ) diff --git a/src/sqlbuild/executor/local/_helpers/runtime.py b/src/sqlbuild/executor/local/_helpers/runtime.py index a364f22c07..1f88769141 100644 --- a/src/sqlbuild/executor/local/_helpers/runtime.py +++ b/src/sqlbuild/executor/local/_helpers/runtime.py @@ -19,7 +19,7 @@ def local_run_refusal(*, error: Exception, fatal: bool) -> LocalRunRefusedError | None: - """Why a SQLQuack guard's raise or DuckDB internal error keeps a test off DuckDB, or None.""" + """Why a SQLBabel guard's raise or DuckDB internal error keeps a test off DuckDB, or None.""" message: str = str(error) guarded: LocalRunRefusedError | None = _guard_refusal(message) @@ -46,7 +46,7 @@ def _guard_refusal(message: str) -> LocalRunRefusedError | None: return None guard: str = raised.group(1) return LocalRunRefusedError( - f"SQLQuack's guard {guard} raised in DuckDB: {raised.group(2)}", + f"SQLBabel's guard {guard} raised in DuckDB: {raised.group(2)}", category=GUARD_CATEGORY, construct=guard, help=CANNOT_RUN_LOCALLY_HELP, diff --git a/src/sqlbuild/executor/local/_helpers/schema.py b/src/sqlbuild/executor/local/_helpers/schema.py index 73fad1c5ad..3b45d062ba 100644 --- a/src/sqlbuild/executor/local/_helpers/schema.py +++ b/src/sqlbuild/executor/local/_helpers/schema.py @@ -1,4 +1,4 @@ -"""The project's declared relations and column types, as SQLQuack's schema option takes them.""" +"""The project's declared relations and column types, as SQLBabel's schema option takes them.""" from __future__ import annotations diff --git a/src/sqlbuild/executor/local/classes/local_test_adapter.py b/src/sqlbuild/executor/local/classes/local_test_adapter.py index 70ed2e9330..2628e97674 100644 --- a/src/sqlbuild/executor/local/classes/local_test_adapter.py +++ b/src/sqlbuild/executor/local/classes/local_test_adapter.py @@ -1,4 +1,4 @@ -"""A run-scoped in-memory DuckDB that runs a project's unit test SQL, converted by SQLQuack.""" +"""A run-scoped in-memory DuckDB that runs a project's unit test SQL, converted by SQLBabel.""" from __future__ import annotations @@ -98,7 +98,7 @@ def _converted_execute(self, *, connection: Any, sql: str) -> Any: ) if not conversion.converted: raise ExecutorInputError( - "SQLQuack refused SQL the local test run needed: " + "SQLBabel refused SQL the local test run needed: " + "; ".join( f"{refusal.get('code')}: {refusal.get('label')}" for refusal in conversion.refusals diff --git a/src/sqlbuild/executor/local/constants.py b/src/sqlbuild/executor/local/constants.py index 0a7140c5ee..ae25abd443 100644 --- a/src/sqlbuild/executor/local/constants.py +++ b/src/sqlbuild/executor/local/constants.py @@ -1,4 +1,4 @@ -"""Where tests and scenarios run, SQLBuild's own reasons, and the SQLQuack vocabulary they read.""" +"""Where tests and scenarios run, SQLBuild's own reasons, and the SQLBabel vocabulary they read.""" from __future__ import annotations @@ -18,11 +18,11 @@ SNAPSHOT_STALE_CATEGORY: str = "snapshot stale" SNAPSHOT_INVALID_CATEGORY: str = "snapshot invalid" -SQLQUACK_SOURCES_HELP: str = "a source file of the project (`sources/*.yml`)" +SQLBABEL_SOURCES_HELP: str = "a source file of the project (`sources/*.yml`)" SQLBUILD_SOURCES_HELP: str = "a source file of the project (`sql/sources/`)" COMMENT_PREFIXES: tuple[str, ...] = ("#", "--") CALL_OPEN: str = "(" -SQLQUACK_ALLOW_HELP: str = ( +SQLBABEL_ALLOW_HELP: str = ( r"allow it with (?P\w+) = true under \[testing\.local\] allow in sqlbuild_project\.toml" ) SQLBUILD_ALLOW_HELP: str = ( @@ -45,13 +45,18 @@ OVERRIDE_LABEL: str = "override" LOCAL_INPUTS_CHECK_SQL: str = "SELECT 1 AS checked" -CONVERSION_CACHE_DIR: str = "target/sqlquack-cache" +CONVERSION_CACHE_DIR: str = "target/sqlbabel-cache" +RETIRED_CONVERSION_CACHE_NAME: str = "sqlquack-cache" +RETIRED_CONVERSION_CACHE_NOTICE: str = ( + "note: {retired} holds conversions from SQLQuack, which local tests no longer read; they are " + "kept in {directory} now. Delete {retired} to free its space.\n" +) CONVERSION_CACHE_INDEX: str = "used.json" CONVERSION_CACHE_LIFETIME_SECONDS: float = 7 * 24 * 60 * 60 CANNOT_RUN_LOCALLY_CODE: str = "T007" CANNOT_RUN_LOCALLY_HELP: str = "Run this test on the warehouse with --run-on warehouse." -GUARD_CATEGORY: str = "SQLQuack guard" +GUARD_CATEGORY: str = "SQLBabel guard" DUCKDB_ERROR_CATEGORY: str = "DuckDB internal error" GENERATED_SQL_NOTE: str = ( diff --git a/src/sqlbuild/executor/local/main/_check_local_test_inputs.py b/src/sqlbuild/executor/local/main/_check_local_test_inputs.py index 45e9ad8439..deed4276a7 100644 --- a/src/sqlbuild/executor/local/main/_check_local_test_inputs.py +++ b/src/sqlbuild/executor/local/main/_check_local_test_inputs.py @@ -1,4 +1,4 @@ -"""Whether SQLQuack can use a project's local test allowances and overrides, checked at compile.""" +"""Whether SQLBabel can use a project's local test allowances and overrides, checked at compile.""" from __future__ import annotations @@ -7,8 +7,8 @@ from dataclasses import replace from pathlib import Path -import sqlquack -from sqlquack import ConvertOptions +import sqlbabel +from sqlbabel import ConvertOptions from sqlbuild.executor.local._helpers.local_inputs import convert_options, local_inputs from sqlbuild.executor.local.constants import LOCAL_INPUTS_CHECK_SQL @@ -16,16 +16,16 @@ def check_local_test_inputs(*, project_dir: Path, allow: Mapping[str, bool]) -> str | None: - """Why SQLQuack can't use the allowances, then the override files it names; `None` if it can.""" + """Why SQLBabel can't use the allowances, then the override files it names; `None` if it can.""" inputs: LocalInputs = local_inputs(project_dir=project_dir, allow=allow) options: ConvertOptions = convert_options(inputs=inputs, schema=None, session={}) try: - _ = sqlquack.convert(sql=LOCAL_INPUTS_CHECK_SQL, options=replace(options, overrides=None)) - except sqlquack.SqlQuackError as error: + _ = sqlbabel.convert(sql=LOCAL_INPUTS_CHECK_SQL, options=replace(options, overrides=None)) + except sqlbabel.SqlBabelError as error: return str(error) try: - _ = sqlquack.convert(sql=LOCAL_INPUTS_CHECK_SQL, options=options) - except sqlquack.SqlQuackError as error: + _ = sqlbabel.convert(sql=LOCAL_INPUTS_CHECK_SQL, options=options) + except sqlbabel.SqlBabelError as error: return str(error).replace(f"{project_dir}{os.sep}", "") return None diff --git a/src/sqlbuild/executor/local/main/_convert_local_sql.py b/src/sqlbuild/executor/local/main/_convert_local_sql.py index 64fdb8c736..22607a51a5 100644 --- a/src/sqlbuild/executor/local/main/_convert_local_sql.py +++ b/src/sqlbuild/executor/local/main/_convert_local_sql.py @@ -1,4 +1,4 @@ -"""SQLQuack's DuckDB conversion of Snowflake SQL, for scenarios replayed locally.""" +"""SQLBabel's DuckDB conversion of Snowflake SQL, for scenarios replayed locally.""" from __future__ import annotations @@ -16,6 +16,6 @@ def convert_local_sql( *, sql: str, schema: Mapping[str, Any] | None, time_zone: str | None, path: str ) -> ConvertedSql: - """SQLQuack's conversion of `sql` in the target's time zone: DuckDB SQL, or its refusals.""" + """SQLBabel's conversion of `sql` in the target's time zone: DuckDB SQL, or its refusals.""" return converted(sql=sql, schema=schema, time_zone=time_zone, path=path) diff --git a/src/sqlbuild/executor/local/main/_local_failure_refusal.py b/src/sqlbuild/executor/local/main/_local_failure_refusal.py index d02c0a0e94..a9fffcab82 100644 --- a/src/sqlbuild/executor/local/main/_local_failure_refusal.py +++ b/src/sqlbuild/executor/local/main/_local_failure_refusal.py @@ -7,6 +7,6 @@ def local_failure_refusal(message: str) -> LocalRunRefusedError | None: - """A SQLQuack guard's raise or DuckDB internal error in `message`, or None.""" + """A SQLBabel guard's raise or DuckDB internal error in `message`, or None.""" return _refusal(message) diff --git a/src/sqlbuild/executor/local/main/_use_local_test_inputs.py b/src/sqlbuild/executor/local/main/_use_local_test_inputs.py index 5cd7f4590f..3c49c7c4cc 100644 --- a/src/sqlbuild/executor/local/main/_use_local_test_inputs.py +++ b/src/sqlbuild/executor/local/main/_use_local_test_inputs.py @@ -1,4 +1,4 @@ -"""Convert local test SQL with the project's SQLQuack allowances and overrides.""" +"""Convert local test SQL with the project's SQLBabel allowances and overrides.""" from __future__ import annotations diff --git a/src/sqlbuild/executor/local/models.py b/src/sqlbuild/executor/local/models.py index 17fab60f61..8a7af04161 100644 --- a/src/sqlbuild/executor/local/models.py +++ b/src/sqlbuild/executor/local/models.py @@ -20,7 +20,7 @@ class MacroPlace: @dataclass(frozen=True) class LocalRefusal: - """One SQLQuack refusal, or one of SQLBuild's own reasons, placed in the file that holds it.""" + """One SQLBabel refusal, or one of SQLBuild's own reasons, placed in the file that holds it.""" category: str construct: str @@ -46,7 +46,7 @@ class LocalRefusal: @property def title(self) -> str: - """`: `, as SQLQuack's census labels a refusal.""" + """`: `, as SQLBabel's census labels a refusal.""" return f"{self.category}: {self.construct}" @@ -110,7 +110,7 @@ class DecisionContext: @dataclass(frozen=True) class ConvertedSql: - """What SQLBuild keeps of a SQLQuack conversion: its DuckDB SQL and macros, or its refusals.""" + """What SQLBuild keeps of a SQLBabel conversion: its DuckDB SQL and macros, or its refusals.""" converted: bool sql: str @@ -122,7 +122,7 @@ class ConvertedSql: @dataclass(frozen=True) class LocalInputs: - """What a project adds to SQLQuack's conversion of its local test SQL: allowances, overrides.""" + """What a project adds to SQLBabel's conversion of its local test SQL: allowances, overrides.""" allow: tuple[tuple[str, bool], ...] = () overrides: str | None = None @@ -131,7 +131,7 @@ class LocalInputs: @dataclass(frozen=True) class LocalSqlCheck: - """One statement's SQLQuack conversion, when asked for, and the relation DuckDB lacks for it.""" + """One statement's SQLBabel conversion, when asked for, and the relation DuckDB lacks for it.""" conversion: ConvertedSql | None missing: str | None diff --git a/src/sqlbuild/executor/scenario/_helpers/local/execution.py b/src/sqlbuild/executor/scenario/_helpers/local/execution.py index 8d1db30322..0583badc7f 100644 --- a/src/sqlbuild/executor/scenario/_helpers/local/execution.py +++ b/src/sqlbuild/executor/scenario/_helpers/local/execution.py @@ -228,7 +228,7 @@ def local_scenario_refusals( capture_dialect: str | None, conversion: LocalConversion, ) -> tuple[dict[str, object], ...]: - """Why a scenario cannot replay locally: its snapshot or SQLQuack's refusals, or nothing.""" + """Why a scenario cannot replay locally: its snapshot or SQLBabel's refusals, or nothing.""" snapshot_state: ScenarioSnapshotStateResult = classify_scenario_snapshot_state( project_dir=project_dir, @@ -295,7 +295,7 @@ def _local_schema( scenario_plan: ScenarioExecutionPlan, conversion: LocalConversion, ) -> dict[str, object]: - """The loaded snapshot tables and the scenario's model tables, as SQLQuack's schema.""" + """The loaded snapshot tables and the scenario's model tables, as SQLBabel's schema.""" relations: dict[str, list[list[str]]] = {} captured: dict[tuple[ScenarioArtifactKind, str], ScenarioSnapshotRelation] = { @@ -794,7 +794,7 @@ def _local_result( def _with_local_refusal(result: ScenarioRunResult) -> ScenarioRunResult: - """`result` as a refusal when a SQLQuack guard or DuckDB internal error failed it locally.""" + """`result` as a refusal when a SQLBabel guard or DuckDB internal error failed it locally.""" messages: list[str] = [ message diff --git a/src/sqlbuild/executor/scenario/_helpers/local/snapshots.py b/src/sqlbuild/executor/scenario/_helpers/local/snapshots.py index 0f4e85ecb5..5439366774 100644 --- a/src/sqlbuild/executor/scenario/_helpers/local/snapshots.py +++ b/src/sqlbuild/executor/scenario/_helpers/local/snapshots.py @@ -369,7 +369,7 @@ def _build_create_table_sql(*, table_name: str, columns: tuple[ScenarioSnapshotC def _storage_column( *, column: ScenarioSnapshotColumn, native_values: bool ) -> ScenarioSnapshotColumn: - """The column as stored locally: SQLQuack reads a captured VARIANT as DuckDB JSON text.""" + """The column as stored locally: SQLBabel reads a captured VARIANT as DuckDB JSON text.""" if native_values or column.local_type.strip().upper() != LOCAL_TYPE_VARIANT: return column diff --git a/src/sqlbuild/executor/scenario/_helpers/local/sql.py b/src/sqlbuild/executor/scenario/_helpers/local/sql.py index 2406ed6d3a..07a48add13 100644 --- a/src/sqlbuild/executor/scenario/_helpers/local/sql.py +++ b/src/sqlbuild/executor/scenario/_helpers/local/sql.py @@ -1,4 +1,4 @@ -"""Local scenario SQL: SQLQuack's DuckDB conversion of captured-dialect SQL, and relation names.""" +"""Local scenario SQL: SQLBabel's DuckDB conversion of captured-dialect SQL, and relation names.""" from __future__ import annotations @@ -35,13 +35,13 @@ def convert_sql_for_local_duckdb( return LocalSql(sql=sql) if source_dialect != CONVERTED_DIALECT: raise LocalSqlRefusedError( - f"Scenario '{scenario_name}' cannot run locally: SQLQuack converts Snowflake SQL " + f"Scenario '{scenario_name}' cannot run locally: SQLBabel converts Snowflake SQL " f"only, not {source_dialect}", refusals=( { "category": DIALECT_REASON_CATEGORY, "construct": str(source_dialect), - "reason": f"SQLQuack converts Snowflake SQL only, not {source_dialect}", + "reason": f"SQLBabel converts Snowflake SQL only, not {source_dialect}", }, ), ) @@ -53,7 +53,7 @@ def convert_sql_for_local_duckdb( ) if not conversion.converted: raise LocalSqlRefusedError( - f"SQLQuack refused the SQL of scenario '{scenario_name}', {resource_kind} " + f"SQLBabel refused the SQL of scenario '{scenario_name}', {resource_kind} " f"'{resource_name}':\n{conversion.rendered.rstrip()}", refusals=tuple( file_placed_refusal(refusal=refusal, sql=sql, file=file) diff --git a/src/sqlbuild/executor/scenario/exceptions.py b/src/sqlbuild/executor/scenario/exceptions.py index 633e67131b..7f6a24e3de 100644 --- a/src/sqlbuild/executor/scenario/exceptions.py +++ b/src/sqlbuild/executor/scenario/exceptions.py @@ -26,7 +26,7 @@ class ScenarioStopRequested(BaseException): # noqa: N818 - a control signal, no class LocalSqlRefusedError(ExecutorInputError): - """SQLQuack refused SQL a local scenario run needs; `refusals` are its JSON refusals.""" + """SQLBabel refused SQL a local scenario run needs; `refusals` are its JSON refusals.""" def __init__(self, message: str, *, refusals: tuple[Mapping[str, Any], ...]) -> None: super().__init__( diff --git a/src/sqlbuild/executor/scenario/models.py b/src/sqlbuild/executor/scenario/models.py index e43db37184..7c4ef82df3 100644 --- a/src/sqlbuild/executor/scenario/models.py +++ b/src/sqlbuild/executor/scenario/models.py @@ -142,7 +142,7 @@ class ScenarioLocalReplaySource: @dataclass(frozen=True) class LocalConversion: - """What SQLQuack's conversion of local scenario SQL reads: model column types and time zone.""" + """What SQLBabel's conversion of local scenario SQL reads: model column types and time zone.""" model_columns: Mapping[str, tuple[tuple[str, str], ...]] = field(default_factory=dict) time_zone: str | None = None diff --git a/tests/e2e/src/sqlbuild/cli/commands/main/compile/_test_types.py b/tests/e2e/src/sqlbuild/cli/commands/main/compile/_test_types.py index f21f19e82d..add28656b4 100644 --- a/tests/e2e/src/sqlbuild/cli/commands/main/compile/_test_types.py +++ b/tests/e2e/src/sqlbuild/cli/commands/main/compile/_test_types.py @@ -1271,7 +1271,7 @@ class BenchmarkProjectTestPlanTestCase: description: str project_dir: Path - # The summary line; with --inspect, SQLQuack's full refusal diagnostics may follow it. + # The summary line; with --inspect, SQLBabel's full refusal diagnostics may follow it. expected_summary_pattern: str diff --git a/tests/e2e/src/sqlbuild/cli/commands/main/scenario/_test_types.py b/tests/e2e/src/sqlbuild/cli/commands/main/scenario/_test_types.py index 232d70c966..e153976230 100644 --- a/tests/e2e/src/sqlbuild/cli/commands/main/scenario/_test_types.py +++ b/tests/e2e/src/sqlbuild/cli/commands/main/scenario/_test_types.py @@ -376,7 +376,7 @@ class CapturedLambdaScenarioTestCase: @dataclass(frozen=True) class GuardedScenarioRunOnTestCase: - """A scenario whose SQLQuack guard raises in DuckDB, run with one `--run-on` value.""" + """A scenario whose SQLBabel guard raises in DuckDB, run with one `--run-on` value.""" description: str run_on: str diff --git a/tests/e2e/src/sqlbuild/cli/commands/main/scenario/helpers.py b/tests/e2e/src/sqlbuild/cli/commands/main/scenario/helpers.py index 6ef24a90bb..117790f354 100644 --- a/tests/e2e/src/sqlbuild/cli/commands/main/scenario/helpers.py +++ b/tests/e2e/src/sqlbuild/cli/commands/main/scenario/helpers.py @@ -1321,7 +1321,7 @@ def build_snowflake_lambda_scenario_project_files() -> dict[str, str]: def build_snowflake_guarded_scenario_project_files() -> dict[str, str]: - """An offline Snowflake project whose model's SQLQuack guard raises on the captured rows.""" + """An offline Snowflake project whose model's SQLBabel guard raises on the captured rows.""" return { **build_snowflake_lambda_scenario_project_files(), diff --git a/tests/e2e/src/sqlbuild/cli/commands/main/scenario/test_authored_check_sql.py b/tests/e2e/src/sqlbuild/cli/commands/main/scenario/test_authored_check_sql.py index 40974cfb47..815df02007 100644 --- a/tests/e2e/src/sqlbuild/cli/commands/main/scenario/test_authored_check_sql.py +++ b/tests/e2e/src/sqlbuild/cli/commands/main/scenario/test_authored_check_sql.py @@ -174,7 +174,7 @@ def test_given_project_dialect_scenario_sql_when_replaying_locally_then_resolves del repo_files["tests/scenarios/order_totals_pass.sql"] del repo_files["tests/scenarios/order_totals_fail.sql"] del repo_files["tests/scenarios/nested/orders_assert_pass.sql"] - # SQLQuack converts a model only when the models it reads declare their column types. + # SQLBabel converts a model only when the models it reads declare their column types. repo_files["sql/models/orders.sql"] = ( "MODEL (\n description 'Test model orders.',\n materialized table,\n" " columns (order_id (type NUMBER(38,0)), amount (type NUMBER(38,0))),\n);\n\n" diff --git a/tests/e2e/src/sqlbuild/cli/commands/main/scenario/test_local_guard.py b/tests/e2e/src/sqlbuild/cli/commands/main/scenario/test_local_guard.py index f9f36bf4ba..ebe488aded 100644 --- a/tests/e2e/src/sqlbuild/cli/commands/main/scenario/test_local_guard.py +++ b/tests/e2e/src/sqlbuild/cli/commands/main/scenario/test_local_guard.py @@ -1,4 +1,4 @@ -"""E2E coverage of a scenario whose SQLQuack guard raises when it replays in DuckDB.""" +"""E2E coverage of a scenario whose SQLBabel guard raises when it replays in DuckDB.""" from __future__ import annotations @@ -28,7 +28,7 @@ description="--run-on local makes it a tool gap naming the guard", run_on="local", expected_exit_code=2, - expected_text="Tool gaps (1 scenario):\n SQLQuack guard: array_agg_order ", + expected_text="Tool gaps (1 scenario):\n SQLBabel guard: array_agg_order ", expected_local_lines=0, ), GuardedScenarioRunOnTestCase( diff --git a/tests/e2e/src/sqlbuild/cli/commands/main/scenario/test_local_macro_dialect.py b/tests/e2e/src/sqlbuild/cli/commands/main/scenario/test_local_macro_dialect.py index 0546a50675..a9ac21b735 100644 --- a/tests/e2e/src/sqlbuild/cli/commands/main/scenario/test_local_macro_dialect.py +++ b/tests/e2e/src/sqlbuild/cli/commands/main/scenario/test_local_macro_dialect.py @@ -40,7 +40,7 @@ ("order_ids__plain", "PASS", "local"), ), expected_absent_rows=(_HASH_SCENARIO,), - expected_fragments=(" SQ0008 HASH gives a different value in DuckDB ",), + expected_fragments=(" SBL0008 HASH gives a different value in DuckDB ",), ), SnowflakeMacroScenarioRunOnTestCase( description="auto replays the macro scenarios and sends only the HASH one to the warehouse", diff --git a/tests/e2e/src/sqlbuild/cli/commands/main/scenario/test_scenario.py b/tests/e2e/src/sqlbuild/cli/commands/main/scenario/test_scenario.py index 947e6456ca..db26d80ce1 100644 --- a/tests/e2e/src/sqlbuild/cli/commands/main/scenario/test_scenario.py +++ b/tests/e2e/src/sqlbuild/cli/commands/main/scenario/test_scenario.py @@ -337,7 +337,7 @@ def test_given_partial_scenario_fixture_when_required_type_is_known_then_typed_n expected_stdout_fragments=( "local_sql_function_transpile_error", "error: dialect", - "SQLQuack converts Snowflake SQL only, not not_a_sql_analysis_dialect", + "SQLBabel converts Snowflake SQL only, not not_a_sql_analysis_dialect", "PASS=0 FAIL=0 NOT_RUN=1 TOTAL=1", ), retained_duckdb_relative_path=Path( diff --git a/tests/e2e/src/sqlbuild/cli/commands/main/sqlite/test_scenarios.py b/tests/e2e/src/sqlbuild/cli/commands/main/sqlite/test_scenarios.py index 1c1a04c1f1..089749a867 100644 --- a/tests/e2e/src/sqlbuild/cli/commands/main/sqlite/test_scenarios.py +++ b/tests/e2e/src/sqlbuild/cli/commands/main/sqlite/test_scenarios.py @@ -36,7 +36,7 @@ expected_tables=("_sqlbuild_relations", "_sqlbuild_schemas"), ), SqliteScenarioE2ETestCase( - description="SQLite scenarios can't run locally: SQLQuack converts Snowflake SQL only", + description="SQLite scenarios can't run locally: SQLBabel converts Snowflake SQL only", command=("scenario", "test", "--run-on", "local", "--sync-snapshots"), expected_outcomes=dict.fromkeys(SCENARIO_OUTCOMES, ("failed", "X607")), expected_tables=("_sqlbuild_relations", "_sqlbuild_schemas"), diff --git a/tests/e2e/src/sqlbuild/cli/commands/main/test/_test_types.py b/tests/e2e/src/sqlbuild/cli/commands/main/test/_test_types.py index e814b1f1d6..0d8a3b5950 100644 --- a/tests/e2e/src/sqlbuild/cli/commands/main/test/_test_types.py +++ b/tests/e2e/src/sqlbuild/cli/commands/main/test/_test_types.py @@ -774,3 +774,12 @@ class LocalPlacementE2ETestCase: expected_refusals: tuple[tuple[str, str, int | None, bool], ...] expected_text: tuple[str, ...] unexpected_text: str + + +@dataclass(frozen=True) +class RetiredConversionCacheE2ETestCase: + """A local run in a project that may still hold SQLQuack's conversion folder.""" + + description: str + folder: str + expected_note_count: int diff --git a/tests/e2e/src/sqlbuild/cli/commands/main/test/test_run_on.py b/tests/e2e/src/sqlbuild/cli/commands/main/test/test_run_on.py index 56b07d82c9..7f8d5d5dad 100644 --- a/tests/e2e/src/sqlbuild/cli/commands/main/test/test_run_on.py +++ b/tests/e2e/src/sqlbuild/cli/commands/main/test/test_run_on.py @@ -1,4 +1,4 @@ -"""`sqb test --run-on`: unit tests run locally in DuckDB when SQLQuack converts them.""" +"""`sqb test --run-on`: unit tests run locally in DuckDB when SQLBabel converts them.""" import json import re @@ -14,6 +14,7 @@ LocalPlacementE2ETestCase, LocalTestInputsE2ETestCase, RefusalReportE2ETestCase, + RetiredConversionCacheE2ETestCase, RunOnFallbackProgressE2ETestCase, RunOnLocalJsonE2ETestCase, RunOnPrecedenceE2ETestCase, @@ -109,7 +110,7 @@ def test_given_waffle_shop_when_testing_locally_then_unit_tests_run_in_duckdb_wi }, expected_refusals=(("node:except", "tests/unit/test_event_payloads.sql", None, True),), expected_text=( - "SQLBuild problem: SQLQuack can't convert EXCEPT", + "SQLBuild problem: SQLBabel can't convert EXCEPT", "--> tests/unit/test_event_payloads.sql\n", ), unexpected_text="target/run/tests", @@ -223,13 +224,13 @@ def test_given_run_on_set_in_several_places_when_testing_then_flag_target_settin "test_case", ( RunOnTextE2ETestCase( - description="--verbose lists SQLQuack's refusals at the model and macro call", + description="--verbose lists SQLBabel's refusals at the model and macro call", command=("test", "--sql", "--run-on", "local", "--verbose"), expected_exit_code=2, expected_text=( " = help: allow it for local tests in sqlbuild_project.toml with\n" " `[testing.local] allow = { hash = true }`;" - " `sqlquack explain hash` says when it is safe\n" + " `sqlbabel explain hash` says when it is safe\n" "\n" " 1. @py.status_hash macro, 1 test \u00b7 1 model\n" " --> sql/models/staging/_sqlbuild/_macros/python/hashing.py:6:14\n" @@ -261,7 +262,7 @@ def test_given_run_on_set_in_several_places_when_testing_then_flag_target_settin ), ids=lambda case: case.description, ) -def test_given_snowflake_project_when_tests_need_conversion_then_reports_sqlquack_refusals( +def test_given_snowflake_project_when_tests_need_conversion_then_reports_sqlbabel_refusals( tmp_path: Path, test_case: RunOnTextE2ETestCase ) -> None: project: Path = prepare_inline_project( @@ -333,7 +334,7 @@ def test_given_snowflake_test_reading_an_unmocked_source_when_testing_then_it_ne command=("test", "--sql", "--select", "test_order_statuses"), expected_exit_code=2, expected_text=( - " note: 1 test moved to the warehouse while running: SQLQuack guard 1" + " note: 1 test moved to the warehouse while running: SQLBabel guard 1" " (--verbose for why)\n" "\n" " Not run (1): needs the warehouse (no connection)\n" @@ -343,7 +344,7 @@ def test_given_snowflake_test_reading_an_unmocked_source_when_testing_then_it_ne description="--run-on local makes a test whose guard raises an error naming the guard", command=("test", "--sql", "--run-on", "local", "--select", "test_order_statuses"), expected_exit_code=2, - expected_text="Tool gaps (1 test):\n SQLQuack guard: array_agg_order ", + expected_text="Tool gaps (1 test):\n SQLBabel guard: array_agg_order ", ), ), ids=lambda case: case.description, @@ -373,7 +374,7 @@ def test_given_snowflake_test_whose_guard_raises_when_testing_then_it_needs_the_ description="one test at a time", concurrency="1", expected_row=( - " note: 1 test moved to the warehouse while running: SQLQuack guard 1" + " note: 1 test moved to the warehouse while running: SQLBabel guard 1" " (--verbose for why)\n" ), expected_starts=0, @@ -383,7 +384,7 @@ def test_given_snowflake_test_whose_guard_raises_when_testing_then_it_needs_the_ description="four tests at a time", concurrency="4", expected_row=( - " note: 1 test moved to the warehouse while running: SQLQuack guard 1" + " note: 1 test moved to the warehouse while running: SQLBabel guard 1" " (--verbose for why)\n" ), expected_starts=0, @@ -424,7 +425,7 @@ def test_given_auto_test_that_falls_back_when_testing_then_only_its_warehouse_at "test_case", ( RunOnLocalJsonE2ETestCase( - description="Snowflake tests report where they ran, why, and SQLQuack's refusals", + description="Snowflake tests report where they ran, why, and SQLBabel's refusals", project="snowflake", expected_exit_code=2, expected_placements={ @@ -443,8 +444,8 @@ def test_given_auto_test_that_falls_back_when_testing_then_only_its_warehouse_at expected_counts=(3, 0), expected_refusal_places=frozenset( { - ("SQ0008", "fn:HASH", "sql/models/staging/stg_orders.sql", 6), - ("SQ0008", "fn:HASH", "sql/models/staging/stg_order_flags.sql", 5), + ("SBL0008", "fn:HASH", "sql/models/staging/stg_orders.sql", 6), + ("SBL0008", "fn:HASH", "sql/models/staging/stg_order_flags.sql", 5), } ), expected_refused_tests=("test_stg_order_flags", "test_stg_orders"), @@ -589,7 +590,7 @@ def test_given_scenario_run_on_flags_when_combined_then_refuses_unsupported_ones ), ), LocalTestInputsE2ETestCase( - description="an override SQLQuack can't read fails compile, naming the file", + description="an override SQLBabel can't read fails compile, naming the file", project_toml_suffix="", extra_files={"tests/overrides/hash.sql": "FUNCTION (\n replaces HASH\n);\nhash(x)\n"}, command=("compile",), @@ -599,7 +600,7 @@ def test_given_scenario_run_on_flags_when_combined_then_refuses_unsupported_ones ), ids=lambda case: case.description, ) -def test_given_local_test_allowances_and_overrides_when_testing_then_sqlquack_uses_them( +def test_given_local_test_allowances_and_overrides_when_testing_then_sqlbabel_uses_them( tmp_path: Path, test_case: LocalTestInputsE2ETestCase ) -> None: files: dict[str, str] = { @@ -626,13 +627,13 @@ def test_given_local_test_allowances_and_overrides_when_testing_then_sqlquack_us "test_case", ( LocalTestInputsE2ETestCase( - description="a DuckDB project can't allow SQLQuack known differences", + description="a DuckDB project can't allow SQLBabel known differences", project_toml_suffix=_ALLOW_HASH, extra_files={}, command=("compile",), expected_exit_code=1, expected_text=( - "[testing.local] allow in sqlbuild_project.toml allows SQLQuack known " + "[testing.local] allow in sqlbuild_project.toml allows SQLBabel known " "differences when local tests convert Snowflake SQL, and this is a duckdb project" ), ), @@ -661,7 +662,7 @@ def test_given_a_duckdb_project_with_local_test_allowances_when_compiling_then_i description="the summary groups causes by who can act; the file keeps every place", expected_summary=( "Allow a known difference (2 tests):\n" - " SQ0008 HASH gives a different value in DuckDB " + " SBL0008 HASH gives a different value in DuckDB " ), expected_report=" 1. @py.status_hash macro, 1 test \u00b7 1 model\n", runnable_test="test_order_status", @@ -703,3 +704,47 @@ def test_given_refused_tests_when_testing_locally_then_summarises_and_writes_the assert test_case.expected_report in report, report assert cleared.returncode == 0, cleared.stdout + cleared.stderr assert not report_file.exists() + + +@pytest.mark.parametrize( + "test_case", + ( + RetiredConversionCacheE2ETestCase( + description="SQLQuack's folder is still there: a note names it and where conversions are", + folder="sqlquack-cache", + expected_note_count=1, + ), + RetiredConversionCacheE2ETestCase( + description="another folder beside the conversions: no note", + folder="other-cache", + expected_note_count=0, + ), + ), + ids=lambda case: case.description, +) +def test_given_sqlquack_conversion_folder_when_testing_locally_then_a_note_says_to_delete_it( + tmp_path: Path, test_case: RetiredConversionCacheE2ETestCase +) -> None: + project: Path = prepare_inline_project( + tmp_path=tmp_path, project_name="retired_cache", repo_files=SNOWFLAKE_FILES + ) + folder: Path = project / "target" / test_case.folder + folder.mkdir(parents=True) + _ = (folder / "used.json").write_text("{}", encoding="utf-8") + + result: CompletedProcess[str] = run_sqb( + command=("--no-color", "test", "--sql", "--run-on", "local", "--json"), + project_dir=project, + ) + + retired: Path = project / "target" / "sqlquack-cache" + note: str = ( + f"note: {retired} holds conversions from SQLQuack, which local tests no longer read; " + f"they are kept in {project / 'target' / 'sqlbabel-cache'} now. Delete {retired} to " + "free its space." + ) + assert result.stderr.count(note) == test_case.expected_note_count, result.stderr + assert result.stderr.count("SQLQuack") == test_case.expected_note_count, result.stderr + assert json.loads(result.stdout)["checks"], result.stdout + assert (project / "target" / "sqlbabel-cache").is_dir() + assert folder.is_dir() diff --git a/tests/unit/src/sqlbuild/cli/project_metadata/test_dependencies.py b/tests/unit/src/sqlbuild/cli/project_metadata/test_dependencies.py index 2f0263aefa..9e47ff8728 100644 --- a/tests/unit/src/sqlbuild/cli/project_metadata/test_dependencies.py +++ b/tests/unit/src/sqlbuild/cli/project_metadata/test_dependencies.py @@ -28,8 +28,8 @@ expected_optional_extra_absent=True, ), ProjectDependencyTestCase( - description="SQLQuack, which converts local test SQL, is a core dependency", - dependency_name="sqlquack", + description="SQLBabel, which converts local test SQL, is a core dependency", + dependency_name="sqlbabel", expected_in_core_dependencies=True, expected_optional_extra_absent=True, ), diff --git a/tests/unit/src/sqlbuild/executor/local/_helpers/_test_types.py b/tests/unit/src/sqlbuild/executor/local/_helpers/_test_types.py index 9f5d6886fe..ff06e2a83f 100644 --- a/tests/unit/src/sqlbuild/executor/local/_helpers/_test_types.py +++ b/tests/unit/src/sqlbuild/executor/local/_helpers/_test_types.py @@ -130,7 +130,7 @@ class ReliedOnTestCase: @dataclass(frozen=True) class SqlbuildHelpTestCase: - """SQLQuack help text, and the help SQLBuild shows for it.""" + """SQLBabel help text, and the help SQLBuild shows for it.""" description: str help_text: str diff --git a/tests/unit/src/sqlbuild/executor/local/_helpers/helpers.py b/tests/unit/src/sqlbuild/executor/local/_helpers/helpers.py index 613c30a384..dbbc598727 100644 --- a/tests/unit/src/sqlbuild/executor/local/_helpers/helpers.py +++ b/tests/unit/src/sqlbuild/executor/local/_helpers/helpers.py @@ -1,4 +1,4 @@ -"""Counting SQLQuack calls while local work is checked.""" +"""Counting SQLBabel calls while local work is checked.""" from __future__ import annotations @@ -6,7 +6,7 @@ from typing import Any import pytest -import sqlquack +import sqlbabel from sqlbuild.executor.local._helpers import conversion as conversion_module from sqlbuild.executor.local._helpers.conversion import check_all, local_check @@ -21,16 +21,16 @@ def counting_convert( monkeypatch: pytest.MonkeyPatch, ) -> list[frozenset[str]]: - """Replace `sqlquack.convert` with one that records each call's schema relations.""" + """Replace `sqlbabel.convert` with one that records each call's schema relations.""" calls: list[frozenset[str]] = [] - original: Callable[..., Any] = sqlquack.convert + original: Callable[..., Any] = sqlbabel.convert def convert(*, sql: str, options: Any, **rest: Any) -> Any: calls.append(frozenset(dict(options.schema or {}).get("relations", {}))) return original(sql=sql, options=options, **rest) - monkeypatch.setattr(sqlquack, "convert", convert) + monkeypatch.setattr(sqlbabel, "convert", convert) return calls diff --git a/tests/unit/src/sqlbuild/executor/local/_helpers/test_conversion_cache.py b/tests/unit/src/sqlbuild/executor/local/_helpers/test_conversion_cache.py index 27861347a7..9bbb3a3596 100644 --- a/tests/unit/src/sqlbuild/executor/local/_helpers/test_conversion_cache.py +++ b/tests/unit/src/sqlbuild/executor/local/_helpers/test_conversion_cache.py @@ -3,7 +3,7 @@ from pathlib import Path import pytest -import sqlquack +import sqlbabel from sqlbuild.executor.local._helpers.conversion import use_conversion_cache, use_local_inputs from sqlbuild.executor.local._helpers.local_inputs import local_inputs @@ -80,7 +80,7 @@ def test_given_conversions_kept_on_disk_when_a_later_run_checks_them_then_none_c "test_case", [ CachedConversionTestCase( - description="another SQLQuack version converts again", + description="another SQLBabel version converts again", statement_count=2, expected_first_conversions=2, expected_later_conversions=2, @@ -89,7 +89,7 @@ def test_given_conversions_kept_on_disk_when_a_later_run_checks_them_then_none_c ], ids=lambda case: case.description, ) -def test_given_another_sqlquack_version_when_checking_then_kept_conversions_are_not_read( +def test_given_another_sqlbabel_version_when_checking_then_kept_conversions_are_not_read( monkeypatch: pytest.MonkeyPatch, tmp_path: Path, test_case: CachedConversionTestCase ) -> None: schema: dict[str, object] = {"relations": dict(ORDERS_SCHEMA_RELATIONS)} @@ -104,7 +104,7 @@ def test_given_another_sqlquack_version_when_checking_then_kept_conversions_are_ first_work: LocalWorkCounts = work_delta(first) fresh_run(monkeypatch) use_conversion_cache(tmp_path) - monkeypatch.setattr(sqlquack, "__version__", f"{sqlquack.__version__}.other") + monkeypatch.setattr(sqlbabel, "__version__", f"{sqlbabel.__version__}.other") later: LocalWorkCounts = work_counts() _ = check_each(statements=statements, schema=schema, repeats=1, convert=True) diff --git a/tests/unit/src/sqlbuild/executor/local/_helpers/test_local_inputs.py b/tests/unit/src/sqlbuild/executor/local/_helpers/test_local_inputs.py index edca1849c7..206abd9dd4 100644 --- a/tests/unit/src/sqlbuild/executor/local/_helpers/test_local_inputs.py +++ b/tests/unit/src/sqlbuild/executor/local/_helpers/test_local_inputs.py @@ -1,4 +1,4 @@ -"""What a local test relied on from the project, read from SQLQuack's report.""" +"""What a local test relied on from the project, read from SQLBabel's report.""" import pytest @@ -27,7 +27,7 @@ expected_relied_on=("HASH (allowed)", "TO_DATE (override)"), ), ReliedOnTestCase( - description="known differences SQLQuack allows by default are not the project's", + description="known differences SQLBabel allows by default are not the project's", known_differences=( {"name": "session_timezone_utc", "allowed_by": "default", "construct": "fn:NOW"}, ), diff --git a/tests/unit/src/sqlbuild/executor/local/_helpers/test_positions.py b/tests/unit/src/sqlbuild/executor/local/_helpers/test_positions.py index 8ea7bf6b23..926b15fd60 100644 --- a/tests/unit/src/sqlbuild/executor/local/_helpers/test_positions.py +++ b/tests/unit/src/sqlbuild/executor/local/_helpers/test_positions.py @@ -41,16 +41,16 @@ description="a known difference is allowed in SQLBuild's own settings", help_text=( "allow it with hash = true under [testing.local] allow in sqlbuild_project.toml;" - " `sqlquack explain hash` says when it is safe" + " `sqlbabel explain hash` says when it is safe" ), expected_help=( "allow it for local tests in sqlbuild_project.toml with" " `[testing.local] allow = { hash = true }`;" - " `sqlquack explain hash` says when it is safe" + " `sqlbabel explain hash` says when it is safe" ), ), SqlbuildHelpTestCase( - description="SQLQuack's source files are SQLBuild's", + description="SQLBabel's source files are SQLBuild's", help_text="declare it in a source file of the project (`sources/*.yml`)", expected_help="declare it in a source file of the project (`sql/sources/`)", ), @@ -62,7 +62,7 @@ ], ids=lambda case: case.description, ) -def test_given_sqlquack_help_when_shown_then_points_at_sqlbuild_settings( +def test_given_sqlbabel_help_when_shown_then_points_at_sqlbuild_settings( test_case: SqlbuildHelpTestCase, ) -> None: assert sqlbuild_help(test_case.help_text) == test_case.expected_help diff --git a/tests/unit/src/sqlbuild/executor/local/_helpers/test_runtime.py b/tests/unit/src/sqlbuild/executor/local/_helpers/test_runtime.py index 01d0288055..2c9051adc9 100644 --- a/tests/unit/src/sqlbuild/executor/local/_helpers/test_runtime.py +++ b/tests/unit/src/sqlbuild/executor/local/_helpers/test_runtime.py @@ -23,7 +23,7 @@ "ARRAY_AGG of several values in no defined order' to INT32" ), fatal=False, - expected_title="SQLQuack guard: array_agg_order", + expected_title="SQLBabel guard: array_agg_order", ), LocalRunRefusalTestCase( description="a DuckDB internal error names its first line", @@ -53,7 +53,7 @@ def test_given_a_guard_or_engine_bug_when_classifying_then_it_refuses_naming_it( description="an emulated Snowflake error is the test's own result", error_type="ConversionException", message=( - "Conversion Error: Could not convert string 'sqlquack:100038#0123456789ab: " + "Conversion Error: Could not convert string 'sqlbabel:100038#0123456789ab: " "Numeric value is not recognized' to INT32" ), fatal=False, @@ -89,7 +89,7 @@ def test_given_an_error_snowflake_would_raise_too_when_classifying_then_it_is_th " 'array_agg_order#0123456789ab: ARRAY_AGG of several values in no defined order'" " to INT32" ), - expected_title="SQLQuack guard: array_agg_order", + expected_title="SQLBabel guard: array_agg_order", ), FailureTextRefusalTestCase( description="a model step DuckDB failed internally", diff --git a/tests/unit/src/sqlbuild/executor/scenario/_helpers/test_capture_columns.py b/tests/unit/src/sqlbuild/executor/scenario/_helpers/test_capture_columns.py index f39bcb92b7..60e1931a04 100644 --- a/tests/unit/src/sqlbuild/executor/scenario/_helpers/test_capture_columns.py +++ b/tests/unit/src/sqlbuild/executor/scenario/_helpers/test_capture_columns.py @@ -159,7 +159,7 @@ expected_local_type="JSON", ), ScenarioSnapshotLocalTypeMappingTestCase( - description="snowflake variant is held as json as sqlquack converts it", + description="snowflake variant is held as json as sqlbabel converts it", sql_analysis_dialect="snowflake", warehouse_type="VARIANT", expected_local_type="JSON", @@ -923,7 +923,7 @@ def test_given_warehouse_type_when_mapping_to_local_type_then_returns_expected_d expected_local_type="JSON", ), ScenarioSnapshotLocalTypeMappingTestCase( - description="snowflake variant is held as json as sqlquack converts it", + description="snowflake variant is held as json as sqlbabel converts it", sql_analysis_dialect="snowflake", warehouse_type="VARIANT", expected_local_type="JSON", diff --git a/tests/unit/src/sqlbuild/executor/scenario/_helpers/test_local_sql.py b/tests/unit/src/sqlbuild/executor/scenario/_helpers/test_local_sql.py index 01cc3387b3..eff6cd4467 100644 --- a/tests/unit/src/sqlbuild/executor/scenario/_helpers/test_local_sql.py +++ b/tests/unit/src/sqlbuild/executor/scenario/_helpers/test_local_sql.py @@ -22,7 +22,7 @@ expected_sql="select ifnull(total, 0) as total, list_value(1, 2) as ids from orders", ), LocalScenarioSqlTestCase( - description="Snowflake captures are converted by SQLQuack", + description="Snowflake captures are converted by SQLBabel", source_dialect="snowflake", sql="select IFNULL(total, 0) as total from orders", expected_sql=( diff --git a/uv.lock b/uv.lock index 1e5e645c0e..68d890285d 100644 --- a/uv.lock +++ b/uv.lock @@ -3689,6 +3689,35 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/e5/30/8519fdde58a7bdf155b714359791ad1dc018b47d60269d5d160d311fdc36/sqlalchemy-2.0.49-py3-none-any.whl", hash = "sha256:ec44cfa7ef1a728e88ad41674de50f6db8cfdb3e2af84af86e0041aaf02d43d0", size = 1942158, upload-time = "2026-04-03T16:53:44.135Z" }, ] +[[package]] +name = "sqlbabel" +version = "0.39.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "sqlbabel-cli" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/ef/72/3699b3dee598f7a8c39827d600385da799fca484bd5d1a2129928cb0b0a9/sqlbabel-0.39.0.tar.gz", hash = "sha256:0c0d8373c5e09477ea0d5399ed193dcdf62c7d7c7ccb2a98ce3c5ef560c0665d", size = 3545978, upload-time = "2026-11-30T11:02:11.96Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/6d/a0/2226770a9f9f56d3ef1a66efa4012163d64b2f51c37a96a24e18999dcdec/sqlbabel-0.39.0-cp312-abi3-macosx_10_15_x86_64.whl", hash = "sha256:f2bcebe11ea191fded758d39342285bae1a609f09e6f113a1885903aa999058a", size = 36190171, upload-time = "2026-11-30T11:01:42.072Z" }, + { url = "https://files.pythonhosted.org/packages/7e/c3/6dbfad91f40f1b38d1ae4acbbc73c6f61079259ad5f34af2f7b134e84748/sqlbabel-0.39.0-cp312-abi3-macosx_11_0_arm64.whl", hash = "sha256:73f97b233d184f0498e1ae4e0da74e02bea0a50848c18ad52d2df77c7e636b1e", size = 33443550, upload-time = "2026-11-30T11:01:45.24Z" }, + { url = "https://files.pythonhosted.org/packages/02/4a/38f6d85a10a28cfdd43b9e061a663942cd159bfbab877f7ddd43e627a11d/sqlbabel-0.39.0-cp312-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:227ae2b1eae7c7dcc6518f1dd9f8230bd09dc82a91179328c17dc6b8f1ecc8d0", size = 36246293, upload-time = "2026-11-30T11:01:47.862Z" }, + { url = "https://files.pythonhosted.org/packages/a6/dc/33c7f769bc45f8f0ea621376850e3a274c156be404328bc9964b967d4c36/sqlbabel-0.39.0-cp312-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:c949ddc87242accf232f0d759a133f597275b33d3b16f6fa685e9a1218a09e43", size = 41249232, upload-time = "2026-11-30T11:01:51.169Z" }, + { url = "https://files.pythonhosted.org/packages/65/91/baf0e0ea8a85bbeace816b7b56d25eeb647d8aca195dd435fa106a06003f/sqlbabel-0.39.0-cp312-abi3-win_amd64.whl", hash = "sha256:82e7e19ac63f1cd92cd288badfe5db2b83665a6b94a11f3029f37abf1253d8f2", size = 36353643, upload-time = "2026-11-30T11:01:54.467Z" }, +] + +[[package]] +name = "sqlbabel-cli" +version = "0.39.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/e4/82/7da209567e780d74c2a1f885b67842a2bdc214e3c65041d6539a45ac6feb/sqlbabel_cli-0.39.0.tar.gz", hash = "sha256:b2de577bed9d49459b7aa9bdacdeb714d2a432055522ac86a565230860ab96cc", size = 3545056, upload-time = "2026-11-30T11:02:13.491Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/86/7d/f88cbb6abc384cdb7f5a19325b463767f4aa1ed023b54ecdf886d908baf3/sqlbabel_cli-0.39.0-py3-none-macosx_10_15_x86_64.whl", hash = "sha256:4fafc38233fbba117814f002189dba1f3a3729d0226075347e83d7c69b5d082f", size = 41846670, upload-time = "2026-11-30T11:01:57.467Z" }, + { url = "https://files.pythonhosted.org/packages/95/ae/d6960bf09c4da9105abe96c03940ee410994fdd0bd0f46661396b14a57ab/sqlbabel_cli-0.39.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:caf1f9adc55f161bd2856c6d280eb2aba74c7f14d831cfa917992ff12de0e185", size = 38694445, upload-time = "2026-11-30T11:02:00.38Z" }, + { url = "https://files.pythonhosted.org/packages/c7/af/5c12adfe5806906e1f5aa12278d15b8e510a48c535bf647ccd761efad650/sqlbabel_cli-0.39.0-py3-none-manylinux_2_28_aarch64.whl", hash = "sha256:9323c469cb5278d9e769ad5e950925a6c09e1984145c8e3c3b2c20ba0e12d068", size = 40911530, upload-time = "2026-11-30T11:02:03.756Z" }, + { url = "https://files.pythonhosted.org/packages/0c/e5/ccb043218d37f5e2ea1843738f469f387510529cd9aa4fc849d97337265e/sqlbabel_cli-0.39.0-py3-none-manylinux_2_28_x86_64.whl", hash = "sha256:c7fe0f32e908af9c625cacc8069459689a40c05c95106be246ab80aca69951db", size = 46010650, upload-time = "2026-11-30T11:02:06.527Z" }, + { url = "https://files.pythonhosted.org/packages/25/08/3b3797c754e0b74738a32faba4e5c78d680dc2c2f6e1779e32e47132dc66/sqlbabel_cli-0.39.0-py3-none-win_amd64.whl", hash = "sha256:f4595b8febe64a2d22b9cae28d27c7c19ec13f556182d84434c195a0d770740e", size = 41752369, upload-time = "2026-11-30T11:02:09.529Z" }, +] + [[package]] name = "sqlbuild" version = "0.275.2" @@ -3699,9 +3728,9 @@ dependencies = [ { name = "orjson" }, { name = "pydantic-settings" }, { name = "pyyaml" }, + { name = "sqlbabel" }, { name = "sqlbuild-cli" }, { name = "sqlload-api" }, - { name = "sqlquack" }, ] [package.optional-dependencies] @@ -3773,9 +3802,9 @@ requires-dist = [ { name = "pyyaml", specifier = ">=6.0.2" }, { name = "rivers", marker = "extra == 'rivers'", specifier = ">=0.1.4" }, { name = "snowflake-connector-python", marker = "extra == 'snowflake'", specifier = ">=4.7.1,<5" }, + { name = "sqlbabel", specifier = "==0.39.0" }, { name = "sqlbuild-cli", directory = "crates/sqlbuild-cli" }, { name = "sqlload-api", specifier = "==0.89.1" }, - { name = "sqlquack", specifier = "==0.25.0" }, ] provides-extras = ["dbt", "snowflake", "bigquery", "databricks", "dagster", "postgres", "sqlserver", "clickhouse", "rivers"] @@ -3832,35 +3861,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/49/4b/359f28a903c13438ef59ebeee215fb25da53066db67b305c125f1c6d2a25/sqlparse-0.5.5-py3-none-any.whl", hash = "sha256:12a08b3bf3eec877c519589833aed092e2444e68240a3577e8e26148acc7b1ba", size = 46138, upload-time = "2025-12-19T07:17:46.573Z" }, ] -[[package]] -name = "sqlquack" -version = "0.25.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "sqlquack-cli" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/b1/1c/b23696825d436bf0870a2f8a528772af6757ff10425d3ac4058a95edd001/sqlquack-0.25.0.tar.gz", hash = "sha256:b726ab728198fde23535be1b0d305441b219e876ac6999273c2decd5d39672fd", size = 2866334, upload-time = "2026-11-27T05:54:31.6Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/8a/3c/cd44180c3374470439b078443b7fb6ddd10b09f22314c76fadae6e585425/sqlquack-0.25.0-cp312-abi3-macosx_10_15_x86_64.whl", hash = "sha256:3b26500cf92d017fd29980005f449c169d62487e42e3992aae036e9cfd1bc357", size = 29880374, upload-time = "2026-11-27T05:53:58.449Z" }, - { url = "https://files.pythonhosted.org/packages/33/a7/0a47f16fafd26e5fb867b2845a7e6a714206e32d8fd5bcc67caed115abc1/sqlquack-0.25.0-cp312-abi3-macosx_11_0_arm64.whl", hash = "sha256:a27989e59f133d374cde62e8d99004a9ed5e1b4c72e8d5924514ff91bbca5a53", size = 27498563, upload-time = "2026-11-27T05:54:01.469Z" }, - { url = "https://files.pythonhosted.org/packages/51/f8/5d940af564df0e29ea6feebea93243e6fb6b8ba10b7d2b4ba252684472a8/sqlquack-0.25.0-cp312-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:541af871bbaf7c01ae938600357439e06f1c9657a15ea397e41c0e973ab6ae78", size = 30539772, upload-time = "2026-11-27T05:54:04.238Z" }, - { url = "https://files.pythonhosted.org/packages/f1/e4/8c4915b17a6201761a75f9b8c046e1637ae53e1eeaebadf9b86f888d3356/sqlquack-0.25.0-cp312-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:619a9066823cd53ae724cc71c5ba5078940af85f9d316d7ea0885cb500382690", size = 34858214, upload-time = "2026-11-27T05:54:07.329Z" }, - { url = "https://files.pythonhosted.org/packages/bc/f3/e0e56da99a3ab130b83e1e6d20786c1d281f28b528227be7e92f3b2892e2/sqlquack-0.25.0-cp312-abi3-win_amd64.whl", hash = "sha256:ef6bcfe43c78337c2e948d975694ac9aced7d113a25ab817763900531c138aa0", size = 28472326, upload-time = "2026-11-27T05:54:10.685Z" }, -] - -[[package]] -name = "sqlquack-cli" -version = "0.25.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/30/15/bb22591617238305d2a8e74d107d614b9f8f76db0d3e58fde1a975162bcb/sqlquack_cli-0.25.0.tar.gz", hash = "sha256:8f9579e26888c7f8ebe9914bca4492d809ef28c1f643e1f4f71104843cdbaf4e", size = 2863767, upload-time = "2026-11-27T05:54:33.344Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/8e/4c/f8ceec014ac2d09aeb64c68a4d4fcf46169d5511d71eaf159022f214f0f5/sqlquack_cli-0.25.0-py3-none-macosx_10_15_x86_64.whl", hash = "sha256:d09aed1677984d79ed6c9967fce76f44687b7e2b1ae4f02e11eeb964601535c8", size = 32619133, upload-time = "2026-11-27T05:54:14.089Z" }, - { url = "https://files.pythonhosted.org/packages/7c/81/82fde9950b0008c0cb6a4b826928a1cc77bdd98e0b011e3b6a200928b96b/sqlquack_cli-0.25.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:c5ba6c6d33ad7e4c4451e792704658707b645d286c3fac7555c0d5c8acdbf684", size = 30028988, upload-time = "2026-11-27T05:54:17.829Z" }, - { url = "https://files.pythonhosted.org/packages/7a/14/186d3ef0c7e7279f0cda02aeed3a522a4581d065f64f0c6553a97baafb64/sqlquack_cli-0.25.0-py3-none-manylinux_2_28_aarch64.whl", hash = "sha256:893440726c032a52acf16bd419894f3636d884a1d2cda297a7f26f89f32fd2cf", size = 32456565, upload-time = "2026-11-27T05:54:21.532Z" }, - { url = "https://files.pythonhosted.org/packages/08/5e/fd7f330e64e9b02c66c75345f8d8e8efd7a01216e9a52debfdb3635125d9/sqlquack_cli-0.25.0-py3-none-manylinux_2_28_x86_64.whl", hash = "sha256:ea77497e59da5659e9f647ec2aa3e5c0adf88b154c1afe8e3ace35efae5fc2b3", size = 36776101, upload-time = "2026-11-27T05:54:25.101Z" }, - { url = "https://files.pythonhosted.org/packages/fb/33/447166a362dab7ce5c3c618b2d6b388242165d3c110435ee6a29ee3be291/sqlquack_cli-0.25.0-py3-none-win_amd64.whl", hash = "sha256:d0fdbb2be8f0cc600d9b7dfb1cd8f2a954ad81faca5b094f04a876347dfb8f3c", size = 30684024, upload-time = "2026-11-27T05:54:28.881Z" }, -] - [[package]] name = "starlette" version = "1.0.0" diff --git a/website/src/content/docs/docs/cli/scenario.mdx b/website/src/content/docs/docs/cli/scenario.mdx index b0786d446c..eb578a411b 100644 --- a/website/src/content/docs/docs/cli/scenario.mdx +++ b/website/src/content/docs/docs/cli/scenario.mdx @@ -96,8 +96,8 @@ sqb scenario test --select revenue | `--run-on` | Where each scenario runs | |------|-------------| -| `auto` (default) | Locally when its snapshot is fresh and SQLQuack converts all its SQL; otherwise on the warehouse | -| `local` | Locally. A scenario with a missing or stale snapshot, or SQL SQLQuack refuses, is not run and fails the run; nothing goes to the warehouse | +| `auto` (default) | Locally when its snapshot is fresh and SQLBabel converts all its SQL; otherwise on the warehouse | +| `local` | Locally. A scenario with a missing or stale snapshot, or SQL SQLBabel refuses, is not run and fails the run; nothing goes to the warehouse | | `warehouse` | On the warehouse | The setting comes from, in order: `--run-on`, the default target's `scenario_run_on`, @@ -180,9 +180,9 @@ Fix in your SQL (1 scenario): The header and the grouped causes work as for [`sqb test`](/docs/cli/test#local-and-warehouse-runs): under `--run-on local` a `Run on` tree and a `Can't run locally (N scenarios):` summary after the failures, with the full report in `target/scenario-refusals.txt`; in `auto` a `note:` line in the header, `--explain` for where each cause is, and -`--verbose` for the full notes after the run. A scenario whose converted SQL hits a SQLQuack guard +`--verbose` for the full notes after the run. A scenario whose converted SQL hits a SQLBabel guard or a DuckDB internal error while it replays runs again on the warehouse in `auto`, with the -reason `SQLQuack guard: ` or `DuckDB internal error: `, and its local attempt +reason `SQLBabel guard: ` or `DuckDB internal error: `, and its local attempt prints nothing; with `--run-on local` it is not run. With `--json`, each scenario has `run_on` and `run_on_reason`, `summary` has `local_count` and `warehouse_count`, and the document has `refusals`, as for `sqb test`. diff --git a/website/src/content/docs/docs/cli/test.mdx b/website/src/content/docs/docs/cli/test.mdx index 4c61efd91f..b295de56b2 100644 --- a/website/src/content/docs/docs/cli/test.mdx +++ b/website/src/content/docs/docs/cli/test.mdx @@ -133,9 +133,9 @@ On the warehouse (3 tests) [ 1] project function customer_orders ``` -A test that hits a SQLQuack guard or a DuckDB internal error while it runs locally runs again on +A test that hits a SQLBabel guard or a DuckDB internal error while it runs locally runs again on the warehouse in `auto`, and a `note:` line after the rows says how many moved and why. -`--verbose` prints the full diagnostics after the run, as notes (`note[SQ0008]`), since these +`--verbose` prints the full diagnostics after the run, as notes (`note[SBL0008]`), since these tests still ran. With `--run-on local`, a test DuckDB can't run as the warehouse would is not run. The header @@ -147,7 +147,7 @@ Tests ready 40 selected, 37 local, 3 can't run locally Run on (40) ├── local 37 DuckDB └── can't run locally 3 2 causes, listed after the run - ├── fn:HASH 2 SQ0008 · 2 models + ├── fn:HASH 2 SBL0008 · 2 models └── project function 1 ``` @@ -163,19 +163,19 @@ per cause with its tests, models and places, grouped by who can act on it: Can't run locally (40 tests): Fix in your SQL (31 tests): - SQ0003 SQLQuack can't convert DATEDIFF for these types 8 tests · 8 models · 8 places [1] - SQ0003 SQLQuack can't convert TO_VARCHAR for these types 6 tests · 6 models · 6 places [2] + SBL0003 SQLBabel can't convert DATEDIFF for these types 8 tests · 8 models · 8 places [1] + SBL0003 SQLBabel can't convert TO_VARCHAR for these types 6 tests · 6 models · 6 places [2] +12 more causes · 17 tests [1] convert the value to a wall time first: `CONVERT_TIMEZONE('UTC', col)::TIMESTAMP_NTZ` [2] the label names the operand types this function covers; cast the operand to one of them Allow a known difference (2 tests): - SQ0008 HASH gives a different value in DuckDB 2 tests · 2 models [3] + SBL0008 HASH gives a different value in DuckDB 2 tests · 2 models [3] [3] allow it for local tests in sqlbuild_project.toml with `[testing.local] allow = { hash = true }` Tool gaps (7 tests): - SQLQuack guard: json_fidelity, float_text +1 5 tests - SQ0002 SQLQuack can't convert IS_DOUBLE yet 2 tests · 1 model + SQLBabel guard: json_fidelity, float_text +1 5 tests + SBL0002 SQLBabel can't convert IS_DOUBLE yet 2 tests · 1 model Every cause in full: target/test-refusals.txt or --verbose; every test: --json (refusals[].tests). ``` @@ -184,7 +184,7 @@ Tool gaps (7 tests): | --- | --- | | Fix in your SQL | A change to the project's SQL lets the test run locally; the help says which | | Allow a known difference | A difference DuckDB has from Snowflake that `[testing.local] allow` can accept | -| Tool gaps | A construct SQLQuack or SQLBuild doesn't run locally yet | +| Tool gaps | A construct SQLBabel or SQLBuild doesn't run locally yet | | Internal errors | DuckDB failing on converted SQL, or a construct only SQLBuild's generated comparison holds; shown in full | Each help prints once, as a numbered note that every row sharing it points to. A section lists @@ -201,7 +201,7 @@ reads `as for above`. A run without refusals removes the file. With `--json`, each check has `run_on` (`local` or `warehouse`) and `run_on_reason` (the first refusal's `: `, or `null`), `summary` has `local_count` and `warehouse_count`, and the document has `refusals`: each refusal once per construct and place, -with SQLQuack's `code`, `category`, `construct`, `reason`, `message`, `label`, `notes` and +with SQLBabel's `code`, `category`, `construct`, `reason`, `message`, `label`, `notes` and `help`, its `path`, `line` and `column` (`line` and `column` are `null` when only the file is known), `generated` (`true` when only SQLBuild's generated comparison holds the construct), its `title` (`: `), and `tests`, the tests it blocks. diff --git a/website/src/content/docs/docs/concepts/project-configuration.mdx b/website/src/content/docs/docs/concepts/project-configuration.mdx index 40e3dddf94..63205df155 100644 --- a/website/src/content/docs/docs/concepts/project-configuration.mdx +++ b/website/src/content/docs/docs/concepts/project-configuration.mdx @@ -700,7 +700,7 @@ delta_compile = true | `unit_test_max_real_models` | `10` | Most real (unmocked) models one SQL unit test may execute; a larger test fails compilation. See [Unit test and scenario limits](#unit-test-and-scenario-limits). | | `test_timeout` | `30s` | Time limit for each SQL unit test, or `"disabled"` | | `scenario_timeout` | none | Time limit for each scenario, or `"disabled"` | -| `test_run_on` | `auto` | Where `sqb test` runs unit tests: `auto` (locally in DuckDB when SQLQuack converts a test, otherwise on the warehouse), `local` or `warehouse`. See [Running tests locally](/docs/concepts/testing-reference#running-tests-locally) | +| `test_run_on` | `auto` | Where `sqb test` runs unit tests: `auto` (locally in DuckDB when SQLBabel converts a test, otherwise on the warehouse), `local` or `warehouse`. See [Running tests locally](/docs/concepts/testing-reference#running-tests-locally) | | `scenario_run_on` | `auto` | Where `sqb scenario test` runs scenarios: `auto` (locally with a fresh snapshot whose SQL converts, otherwise on the warehouse), `local` or `warehouse`. See [Local scenario testing](/docs/concepts/scenarios#local-scenario-testing) | | `delta_compile` | `true` | After an edit to model SQL or SQL test files only, compile just the changed files against the previous compile. See [Compiling after an edit](/docs/cli/compile#compiling-after-an-edit). | | `allow_missing_secrets` | `false` | Let `compile`, `rules run`, `format`, `dag`, `lineage` and `scope` run without any provider's secrets on this machine. `sqlbuild_local.toml` only; a target lists the providers it expects to miss in [`[targets.] allow_missing_secrets`](#allowed-missing-secrets). See [Secrets](/docs/concepts/python-nodes/providers#allowing-missing-secrets). | @@ -898,7 +898,7 @@ See [Scenarios](/docs/concepts/scenarios) for details on local type overrides an ## Testing -The SQLQuack known differences that local unit tests may rely on, by name: +The SQLBabel known differences that local unit tests may rely on, by name: ```toml [testing.local] @@ -1068,7 +1068,7 @@ Python is supported only under `python/`, `rules/`, `orchestration/`, `sql/hooks The project's `tests/` directory holds SQL tests and scenarios, and pytest tests of project Python under `tests/python/nodes/`, `tests/python/providers/` and `tests/orchestration/`, which `sqb test` -runs; see [Python tests](/docs/cli/test#python-tests). `tests/overrides/` holds the SQLQuack +runs; see [Python tests](/docs/cli/test#python-tests). `tests/overrides/` holds the SQLBabel overrides local unit tests use; see [Allowing known differences and overrides](/docs/concepts/testing-reference#allowing-known-differences-and-overrides). Orchestrator code such as Dagster or Rivers definitions lives outside the SQLBuild project directory and points at it; see diff --git a/website/src/content/docs/docs/concepts/scenarios.mdx b/website/src/content/docs/docs/concepts/scenarios.mdx index 300978edbf..e9ca0903d0 100644 --- a/website/src/content/docs/docs/concepts/scenarios.mdx +++ b/website/src/content/docs/docs/concepts/scenarios.mdx @@ -317,7 +317,7 @@ Run scenarios locally against DuckDB: sqb scenario test --run-on local ``` -By default (`auto`), a scenario replays locally when its snapshot is fresh and SQLQuack converts +By default (`auto`), a scenario replays locally when its snapshot is fresh and SQLBabel converts all of its SQL, and runs on the warehouse otherwise. With `--run-on local`, every scenario replays locally, and one that cannot is not run and fails the run. Set the default with `[settings] scenario_run_on` or a target's `scenario_run_on`; see [`sqb scenario test`](/docs/cli/scenario#where-scenarios-run). @@ -327,7 +327,7 @@ Local replay: 1. Checks snapshot freshness via the input fingerprint; a missing or stale snapshot keeps the scenario off DuckDB 2. Creates a temporary DuckDB database at `target/run/scenarios//local.duckdb` 3. Loads JSONL snapshots into typed DuckDB tables using column metadata from `scenario.json` -4. Converts function, model and check SQL from Snowflake to DuckDB with [SQLQuack](https://github.com/sqlstack-io/sqlquack), in a UTC session, reading the snapshot columns' captured types and models' declared column types; SQL captured from a DuckDB project runs as authored, and other adapters' scenarios run on the warehouse +4. Converts function, model and check SQL from Snowflake to DuckDB with [SQLBabel](https://github.com/sqlstack-io/sqlbabel), in a UTC session, reading the snapshot columns' captured types and models' declared column types; SQL captured from a DuckDB project runs as authored, and other adapters' scenarios run on the warehouse 5. Builds functions, models, and runs expected/assertion checks in DuckDB 6. Keeps the local DuckDB file for inspection (it lives under `target/`, so it's always retained) @@ -382,5 +382,5 @@ See the [CLI reference](/docs/cli/scenario) for full command documentation. order, whitespace and number spelling do not matter, so a Snowflake capture's pretty-printed JSON equals an expected `PARSE_JSON(...)`. Values of non-JSON types with the same JSON text also compare equal, for example `DATE '2024-01-01'::VARIANT` and `'2024-01-01'::VARIANT`. -- Local replay runs only SQL SQLQuack converts. A model read by another model needs fully typed declared columns, or SQLQuack refuses the reading SQL (`unresolved name`) and the scenario runs on the warehouse. +- Local replay runs only SQL SQLBabel converts. A model read by another model needs fully typed declared columns, or SQLBabel refuses the reading SQL (`unresolved name`) and the scenario runs on the warehouse. - Outside local replay, scenario fixture, expected and assertion SQL runs as authored: SQLBuild replaces `__ref`, `__source`, `__seed` and `__dbt_ref` calls with relation names and may wrap a partial fixture to add its missing columns, but never regenerates the query. Calls inside comments and quoted text are left unchanged. Quoted text and comments follow the project adapter's rules, including in local replay: backslash escapes on Snowflake, BigQuery and Databricks, `E'...'` strings on DuckDB and Postgres, nested block comments on DuckDB, Postgres, Databricks and SQL Server, `#` line comments on BigQuery, and `//` line comments on Snowflake. A call naming a relation the scenario does not provide, or SQL with an unclosed string or comment, fails planning with `S511` naming the scenario file. diff --git a/website/src/content/docs/docs/concepts/testing-reference.mdx b/website/src/content/docs/docs/concepts/testing-reference.mdx index d99e14d622..66a187f780 100644 --- a/website/src/content/docs/docs/concepts/testing-reference.mdx +++ b/website/src/content/docs/docs/concepts/testing-reference.mdx @@ -427,8 +427,8 @@ credentials. | Setting | Where each test runs | | --- | --- | -| `auto` (default) | Locally when [SQLQuack](https://github.com/sqlstack-io/sqlquack) converts its comparison SQL to DuckDB, otherwise on the warehouse | -| `local` | Locally. A test SQLQuack refuses is not run (`NOT_RUN=`, `T007` in `--json`), and `sqb test` exits `2` when no test failed; it is never sent to the warehouse | +| `auto` (default) | Locally when [SQLBabel](https://github.com/sqlstack-io/sqlbabel) converts its comparison SQL to DuckDB, otherwise on the warehouse | +| `local` | Locally. A test SQLBabel refuses is not run (`NOT_RUN=`, `T007` in `--json`), and `sqb test` exits `2` when no test failed; it is never sent to the warehouse | | `warehouse` | On the warehouse, as every test ran before | The setting comes from, in order: `--run-on`, the selected target's `test_run_on` (a target in @@ -445,31 +445,31 @@ test_run_on = "local" How SQLBuild decides, at compile time, before anything runs: -- **Snowflake projects.** SQLQuack converts the test's comparison SQL: every real model in its - chain, its fixtures, expected rows and assertions. SQLQuack converts only constructs whose rules +- **Snowflake projects.** SQLBabel converts the test's comparison SQL: every real model in its + chain, its fixtures, expected rows and assertions. SQLBabel converts only constructs whose rules were verified against recorded Snowflake results, and refuses anything else. SQLBuild gives - SQLQuack the declared columns of the project's sources, seeds and models. + SQLBabel the declared columns of the project's sources, seeds and models. - **DuckDB projects.** The SQL is already DuckDB SQL, so tests run locally as written. - **Project functions.** A local run makes temporary copies of the functions a test calls. A function whose body reads a table or view, or any function in a project that isn't DuckDB, needs the warehouse (reason `project function: `). - **Unmocked relations.** A test whose SQL still reads a relation the local database doesn't have, rather than one of its fixtures, needs the warehouse (reason `warehouse relation: `). In a - Snowflake project SQLQuack refuses names the project doesn't declare, and a declared relation the + Snowflake project SQLBabel refuses names the project doesn't declare, and a declared relation the converted SQL reads by name, such as a table a model names directly, is one only the warehouse has. - **Work per run.** Each distinct test statement is converted once, in worker processes, and the - test run reuses those conversions. Conversions are kept in `target/sqlquack-cache/`, keyed by the - SQL, the declared relations it reads, the session and the SQLQuack version, so a later run + test run reuses those conversions. Conversions are kept in `target/sqlbabel-cache/`, keyed by the + SQL, the declared relations it reads, the session and the SQLBabel version, so a later run converts only the statements that changed. At the end of a run, SQLBuild deletes the conversions no run has used for 7 days. Deleting the folder is always safe. -- **Other adapters.** SQLQuack converts Snowflake SQL only, so tests run on the warehouse (reason +- **Other adapters.** SQLBabel converts Snowflake SQL only, so tests run on the warehouse (reason `dialect: `). - **Time zone.** Local runs use a UTC session. When the target's connection sets another - `TIMEZONE` in `session_parameters`, SQLQuack refuses SQL whose result depends on the time zone, + `TIMEZONE` in `session_parameters`, SQLBabel refuses SQL whose result depends on the time zone, and those tests go to the warehouse. `sqb test --inspect` adds one line per test: `runs on: local`, or -`runs on: warehouse ()`, where the reason is SQLQuack's refusal label +`runs on: warehouse ()`, where the reason is SQLBabel's refusal label `: `, such as `missing rule: node:method_call` or `a known difference that isn't allowed: fn:HASH`. The full diagnostics follow the plan. @@ -477,10 +477,10 @@ In `auto`, when the warehouse connection cannot be made, the local tests still r warehouse test is not run (`NOT_RUN=`, `T008` in `--json`), and a `Not run (N): needs the warehouse (no connection)` line says why. -Some problems only show when a test runs. SQLQuack's converted SQL raises, instead of returning a +Some problems only show when a test runs. SQLBabel's converted SQL raises, instead of returning a different value, for inputs DuckDB would read differently from Snowflake, and DuckDB can fail with an internal error on SQL it accepted. In `auto` such a test runs again on the warehouse, with the -reason `SQLQuack guard: `, such as `SQLQuack guard: array_agg_order`, or +reason `SQLBabel guard: `, such as `SQLBabel guard: array_agg_order`, or `DuckDB internal error: `. The local attempt prints nothing; the test's row shows `warehouse`, and a `note:` line after the rows counts the tests that moved and why. With `--run-on local` it is not run, and `Can't run locally` names the guard. An error Snowflake would raise too, such as a value that isn't a number, is the test's @@ -488,7 +488,7 @@ own result wherever it runs. ### Allowing known differences and overrides -In a Snowflake project, a test SQLQuack refuses only because a construct behaves differently in +In a Snowflake project, a test SQLBabel refuses only because a construct behaves differently in DuckDB, such as `HASH`, can still run locally. Allow the known difference for local tests in `sqlbuild_project.toml`: @@ -497,8 +497,8 @@ DuckDB, such as `HASH`, can still run locally. Allow the known difference for lo allow = { hash = true } ``` -Or replace the function for local tests with a SQLQuack override in `tests/overrides/`, one file per -function, in SQLQuack's `FUNCTION()` format: +Or replace the function for local tests with a SQLBabel override in `tests/overrides/`, one file per +function, in SQLBabel's `FUNCTION()` format: ```sql -- tests/overrides/hash.sql @@ -518,13 +518,13 @@ A test that relies on either says so in its row and in `sqb test --inspect`: ``` The refusal's help names the setting: `allow it with hash = true under [testing.local] allow in -sqlbuild_project.toml`. `sqlquack explain ` says when a known difference is safe to allow. +sqlbuild_project.toml`. `sqlbabel explain ` says when a known difference is safe to allow. Details: -- The names are SQLQuack's known-difference names. A name SQLQuack doesn't know fails compile, with +- The names are SQLBabel's known-difference names. A name SQLBabel doesn't know fails compile, with the nearest name it knows. -- Two override files replacing one function, or a file SQLQuack can't read, fail compile, naming +- Two override files replacing one function, or a file SQLBabel can't read, fail compile, naming the files. - Allowances and overrides apply to local runs only. Warehouse tests, builds and deploys never read them. From 32387409e8121ef511be45a631bb9a617d0d951c Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Mon, 30 Nov 2026 13:02:12 +0000 Subject: [PATCH 2/2] test: expect SQLBabel in the removed scenario option messages --- tests/e2e/src/sqlbuild/cli/commands/main/test/test_run_on.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/e2e/src/sqlbuild/cli/commands/main/test/test_run_on.py b/tests/e2e/src/sqlbuild/cli/commands/main/test/test_run_on.py index b9703a2836..4d5cc3c3b7 100644 --- a/tests/e2e/src/sqlbuild/cli/commands/main/test/test_run_on.py +++ b/tests/e2e/src/sqlbuild/cli/commands/main/test/test_run_on.py @@ -497,14 +497,14 @@ def test_given_project_when_testing_locally_with_json_then_reports_where_and_why command=("scenario", "test", "--sync-snapshots"), expected_fragment=( "--sync-snapshots was removed; scenarios now convert their fixture CTEs with " - "SQLQuack, so there are no snapshots to sync; run sqb scenario test --run-on local" + "SQLBabel, so there are no snapshots to sync; run sqb scenario test --run-on local" ), ), ScenarioRunOnFlagsE2ETestCase( description="scenario capture is gone and names local runs instead", command=("scenario", "capture"), expected_fragment=( - "'capture' was removed; scenarios now convert their fixture CTEs with SQLQuack" + "'capture' was removed; scenarios now convert their fixture CTEs with SQLBabel" ), ), ),