diff --git a/Cargo.lock b/Cargo.lock index 78a708f10b..b50730a98e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6215,7 +6215,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" dependencies = [ "libc", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -6256,6 +6256,177 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a0219bd7d979d58245a4f41f695e1ac9f8befdffadd7f61f1bae9e39abc6620" +[[package]] +name = "sqlbabel-derive" +version = "0.39.0" +source = "git+https://github.com/sqlstack-io/sqlbabel.git?rev=b7b8acba57c0a81b173d328cf7e246a927a6dd93#b7b8acba57c0a81b173d328cf7e246a927a6dd93" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "sqlbabel-diagnostics" +version = "0.39.0" +source = "git+https://github.com/sqlstack-io/sqlbabel.git?rev=b7b8acba57c0a81b173d328cf7e246a927a6dd93#b7b8acba57c0a81b173d328cf7e246a927a6dd93" +dependencies = [ + "serde", + "serde_json", + "sqlbabel-syntax", +] + +[[package]] +name = "sqlbabel-fingerprint" +version = "0.39.0" +source = "git+https://github.com/sqlstack-io/sqlbabel.git?rev=b7b8acba57c0a81b173d328cf7e246a927a6dd93#b7b8acba57c0a81b173d328cf7e246a927a6dd93" +dependencies = [ + "sha2 0.10.9", + "sqlbabel-parse", + "sqlbabel-syntax", + "sqlbabel-tokenize", +] + +[[package]] +name = "sqlbabel-format" +version = "0.39.0" +source = "git+https://github.com/sqlstack-io/sqlbabel.git?rev=b7b8acba57c0a81b173d328cf7e246a927a6dd93#b7b8acba57c0a81b173d328cf7e246a927a6dd93" +dependencies = [ + "serde_json", + "sqlbabel-parse", + "sqlbabel-syntax", + "sqlbabel-tokenize", +] + +[[package]] +name = "sqlbabel-parse" +version = "0.39.0" +source = "git+https://github.com/sqlstack-io/sqlbabel.git?rev=b7b8acba57c0a81b173d328cf7e246a927a6dd93#b7b8acba57c0a81b173d328cf7e246a927a6dd93" +dependencies = [ + "sqlbabel-syntax", + "sqlbabel-syntax-bigquery", + "sqlbabel-syntax-databricks", + "sqlbabel-syntax-postgres", + "sqlbabel-syntax-snowflake", + "sqlbabel-syntax-sqlserver", +] + +[[package]] +name = "sqlbabel-semantics" +version = "0.39.0" +source = "git+https://github.com/sqlstack-io/sqlbabel.git?rev=b7b8acba57c0a81b173d328cf7e246a927a6dd93#b7b8acba57c0a81b173d328cf7e246a927a6dd93" +dependencies = [ + "regex", + "rustc-hash", + "saphyr-parser", + "serde", + "serde_json", + "sqlbabel-diagnostics", + "sqlbabel-parse", + "sqlbabel-syntax", + "stacker", +] + +[[package]] +name = "sqlbabel-syntax" +version = "0.39.0" +source = "git+https://github.com/sqlstack-io/sqlbabel.git?rev=b7b8acba57c0a81b173d328cf7e246a927a6dd93#b7b8acba57c0a81b173d328cf7e246a927a6dd93" +dependencies = [ + "serde", + "serde_json", + "sqlbabel-derive", + "stacker", + "thiserror 1.0.69", + "unicode-segmentation", +] + +[[package]] +name = "sqlbabel-syntax-bigquery" +version = "0.39.0" +source = "git+https://github.com/sqlstack-io/sqlbabel.git?rev=b7b8acba57c0a81b173d328cf7e246a927a6dd93#b7b8acba57c0a81b173d328cf7e246a927a6dd93" +dependencies = [ + "sqlbabel-syntax", + "stacker", +] + +[[package]] +name = "sqlbabel-syntax-clickhouse" +version = "0.39.0" +source = "git+https://github.com/sqlstack-io/sqlbabel.git?rev=b7b8acba57c0a81b173d328cf7e246a927a6dd93#b7b8acba57c0a81b173d328cf7e246a927a6dd93" +dependencies = [ + "sqlbabel-syntax", + "stacker", +] + +[[package]] +name = "sqlbabel-syntax-databricks" +version = "0.39.0" +source = "git+https://github.com/sqlstack-io/sqlbabel.git?rev=b7b8acba57c0a81b173d328cf7e246a927a6dd93#b7b8acba57c0a81b173d328cf7e246a927a6dd93" +dependencies = [ + "sqlbabel-syntax", + "stacker", +] + +[[package]] +name = "sqlbabel-syntax-duckdb" +version = "0.39.0" +source = "git+https://github.com/sqlstack-io/sqlbabel.git?rev=b7b8acba57c0a81b173d328cf7e246a927a6dd93#b7b8acba57c0a81b173d328cf7e246a927a6dd93" +dependencies = [ + "sqlbabel-syntax", + "stacker", +] + +[[package]] +name = "sqlbabel-syntax-postgres" +version = "0.39.0" +source = "git+https://github.com/sqlstack-io/sqlbabel.git?rev=b7b8acba57c0a81b173d328cf7e246a927a6dd93#b7b8acba57c0a81b173d328cf7e246a927a6dd93" +dependencies = [ + "sqlbabel-syntax", + "stacker", +] + +[[package]] +name = "sqlbabel-syntax-snowflake" +version = "0.39.0" +source = "git+https://github.com/sqlstack-io/sqlbabel.git?rev=b7b8acba57c0a81b173d328cf7e246a927a6dd93#b7b8acba57c0a81b173d328cf7e246a927a6dd93" +dependencies = [ + "serde", + "serde_json", + "sqlbabel-syntax", + "sqlbabel-tokenize", + "stacker", + "thiserror 1.0.69", + "unicode-segmentation", +] + +[[package]] +name = "sqlbabel-syntax-sqlite" +version = "0.39.0" +source = "git+https://github.com/sqlstack-io/sqlbabel.git?rev=b7b8acba57c0a81b173d328cf7e246a927a6dd93#b7b8acba57c0a81b173d328cf7e246a927a6dd93" +dependencies = [ + "sqlbabel-syntax", + "stacker", +] + +[[package]] +name = "sqlbabel-syntax-sqlserver" +version = "0.39.0" +source = "git+https://github.com/sqlstack-io/sqlbabel.git?rev=b7b8acba57c0a81b173d328cf7e246a927a6dd93#b7b8acba57c0a81b173d328cf7e246a927a6dd93" +dependencies = [ + "sqlbabel-syntax", + "sqlbabel-tokenize", + "stacker", +] + +[[package]] +name = "sqlbabel-tokenize" +version = "0.39.0" +source = "git+https://github.com/sqlstack-io/sqlbabel.git?rev=b7b8acba57c0a81b173d328cf7e246a927a6dd93#b7b8acba57c0a81b173d328cf7e246a927a6dd93" +dependencies = [ + "sqlbabel-syntax", + "thiserror 1.0.69", +] + [[package]] name = "sqlbuild-analysis" version = "0.0.0" @@ -6268,6 +6439,18 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.9", + "sqlbabel-fingerprint", + "sqlbabel-parse", + "sqlbabel-semantics", + "sqlbabel-syntax", + "sqlbabel-syntax-bigquery", + "sqlbabel-syntax-clickhouse", + "sqlbabel-syntax-databricks", + "sqlbabel-syntax-duckdb", + "sqlbabel-syntax-postgres", + "sqlbabel-syntax-sqlite", + "sqlbabel-syntax-sqlserver", + "sqlbabel-tokenize", "sqlbuild-attachments", "sqlbuild-cache", "sqlbuild-core", @@ -6277,18 +6460,6 @@ dependencies = [ "sqlbuild-render", "sqlbuild-scopes", "sqlbuild-sqltext", - "sqlquack-fingerprint", - "sqlquack-parse", - "sqlquack-semantics", - "sqlquack-syntax", - "sqlquack-syntax-bigquery", - "sqlquack-syntax-clickhouse", - "sqlquack-syntax-databricks", - "sqlquack-syntax-duckdb", - "sqlquack-syntax-postgres", - "sqlquack-syntax-sqlite", - "sqlquack-syntax-sqlserver", - "sqlquack-tokenize", "stacker", ] @@ -6526,12 +6697,12 @@ dependencies = [ "serde_ignored", "serde_json", "serde_path_to_error", + "sqlbabel-fingerprint", "sqlbuild-core", "sqlbuild-cursor", "sqlbuild-model-config", "sqlbuild-recall", "sqlbuild-state", - "sqlquack-fingerprint", "sqlx-core", "sqlx-postgres", "subtle", @@ -6856,6 +7027,9 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.9", + "sqlbabel-parse", + "sqlbabel-syntax", + "sqlbabel-tokenize", "sqlbuild-analysis", "sqlbuild-attachments", "sqlbuild-cache", @@ -6865,9 +7039,6 @@ dependencies = [ "sqlbuild-scopes", "sqlbuild-sqltext", "sqlclean", - "sqlquack-parse", - "sqlquack-syntax", - "sqlquack-tokenize", "stacker", "stats_alloc", "tempfile", @@ -6910,44 +7081,44 @@ dependencies = [ [[package]] name = "sqlclean" -version = "0.12.2" -source = "git+https://github.com/sqlstack-io/sqlclean.git?rev=ac9aa4f4f8ef234d4bed3a80dc7e8c1ecac9b81a#ac9aa4f4f8ef234d4bed3a80dc7e8c1ecac9b81a" +version = "0.12.3" +source = "git+https://github.com/sqlstack-io/sqlclean.git?rev=1b54018c4561fbbba7c3dd057e56bdfab641c887#1b54018c4561fbbba7c3dd057e56bdfab641c887" dependencies = [ "rayon", "rustc-hash", "serde", "serde_json", "sha2 0.10.9", + "sqlbabel-fingerprint", + "sqlbabel-format", + "sqlbabel-parse", + "sqlbabel-syntax", + "sqlbabel-syntax-sqlserver", + "sqlbabel-tokenize", "sqlclean-lint", - "sqlquack-fingerprint", - "sqlquack-format", - "sqlquack-parse", - "sqlquack-syntax", - "sqlquack-syntax-sqlserver", - "sqlquack-tokenize", ] [[package]] name = "sqlclean-lint" -version = "0.12.2" -source = "git+https://github.com/sqlstack-io/sqlclean.git?rev=ac9aa4f4f8ef234d4bed3a80dc7e8c1ecac9b81a#ac9aa4f4f8ef234d4bed3a80dc7e8c1ecac9b81a" +version = "0.12.3" +source = "git+https://github.com/sqlstack-io/sqlclean.git?rev=1b54018c4561fbbba7c3dd057e56bdfab641c887#1b54018c4561fbbba7c3dd057e56bdfab641c887" dependencies = [ "rayon", "serde", "serde_json", + "sqlbabel-parse", + "sqlbabel-semantics", + "sqlbabel-syntax", + "sqlbabel-tokenize", "sqlclean-rules", - "sqlquack-parse", - "sqlquack-semantics", - "sqlquack-syntax", - "sqlquack-tokenize", ] [[package]] name = "sqlclean-rules" -version = "0.12.2" -source = "git+https://github.com/sqlstack-io/sqlclean.git?rev=ac9aa4f4f8ef234d4bed3a80dc7e8c1ecac9b81a#ac9aa4f4f8ef234d4bed3a80dc7e8c1ecac9b81a" +version = "0.12.3" +source = "git+https://github.com/sqlstack-io/sqlclean.git?rev=1b54018c4561fbbba7c3dd057e56bdfab641c887#1b54018c4561fbbba7c3dd057e56bdfab641c887" dependencies = [ - "sqlquack-syntax", + "sqlbabel-syntax", ] [[package]] @@ -7041,177 +7212,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "sqlquack-derive" -version = "0.25.0" -source = "git+https://github.com/sqlstack-io/sqlquack.git?rev=9d74b31a8d4cb14aa98d994345d3c90167646c75#9d74b31a8d4cb14aa98d994345d3c90167646c75" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.119", -] - -[[package]] -name = "sqlquack-diagnostics" -version = "0.25.0" -source = "git+https://github.com/sqlstack-io/sqlquack.git?rev=9d74b31a8d4cb14aa98d994345d3c90167646c75#9d74b31a8d4cb14aa98d994345d3c90167646c75" -dependencies = [ - "serde", - "serde_json", - "sqlquack-syntax", -] - -[[package]] -name = "sqlquack-fingerprint" -version = "0.25.0" -source = "git+https://github.com/sqlstack-io/sqlquack.git?rev=9d74b31a8d4cb14aa98d994345d3c90167646c75#9d74b31a8d4cb14aa98d994345d3c90167646c75" -dependencies = [ - "sha2 0.10.9", - "sqlquack-parse", - "sqlquack-syntax", - "sqlquack-tokenize", -] - -[[package]] -name = "sqlquack-format" -version = "0.25.0" -source = "git+https://github.com/sqlstack-io/sqlquack.git?rev=9d74b31a8d4cb14aa98d994345d3c90167646c75#9d74b31a8d4cb14aa98d994345d3c90167646c75" -dependencies = [ - "serde_json", - "sqlquack-parse", - "sqlquack-syntax", - "sqlquack-tokenize", -] - -[[package]] -name = "sqlquack-parse" -version = "0.25.0" -source = "git+https://github.com/sqlstack-io/sqlquack.git?rev=9d74b31a8d4cb14aa98d994345d3c90167646c75#9d74b31a8d4cb14aa98d994345d3c90167646c75" -dependencies = [ - "sqlquack-syntax", - "sqlquack-syntax-bigquery", - "sqlquack-syntax-databricks", - "sqlquack-syntax-postgres", - "sqlquack-syntax-snowflake", - "sqlquack-syntax-sqlserver", -] - -[[package]] -name = "sqlquack-semantics" -version = "0.25.0" -source = "git+https://github.com/sqlstack-io/sqlquack.git?rev=9d74b31a8d4cb14aa98d994345d3c90167646c75#9d74b31a8d4cb14aa98d994345d3c90167646c75" -dependencies = [ - "regex", - "rustc-hash", - "saphyr-parser", - "serde", - "serde_json", - "sqlquack-diagnostics", - "sqlquack-parse", - "sqlquack-syntax", - "stacker", -] - -[[package]] -name = "sqlquack-syntax" -version = "0.25.0" -source = "git+https://github.com/sqlstack-io/sqlquack.git?rev=9d74b31a8d4cb14aa98d994345d3c90167646c75#9d74b31a8d4cb14aa98d994345d3c90167646c75" -dependencies = [ - "serde", - "serde_json", - "sqlquack-derive", - "stacker", - "thiserror 1.0.69", - "unicode-segmentation", -] - -[[package]] -name = "sqlquack-syntax-bigquery" -version = "0.25.0" -source = "git+https://github.com/sqlstack-io/sqlquack.git?rev=9d74b31a8d4cb14aa98d994345d3c90167646c75#9d74b31a8d4cb14aa98d994345d3c90167646c75" -dependencies = [ - "sqlquack-syntax", - "stacker", -] - -[[package]] -name = "sqlquack-syntax-clickhouse" -version = "0.25.0" -source = "git+https://github.com/sqlstack-io/sqlquack.git?rev=9d74b31a8d4cb14aa98d994345d3c90167646c75#9d74b31a8d4cb14aa98d994345d3c90167646c75" -dependencies = [ - "sqlquack-syntax", - "stacker", -] - -[[package]] -name = "sqlquack-syntax-databricks" -version = "0.25.0" -source = "git+https://github.com/sqlstack-io/sqlquack.git?rev=9d74b31a8d4cb14aa98d994345d3c90167646c75#9d74b31a8d4cb14aa98d994345d3c90167646c75" -dependencies = [ - "sqlquack-syntax", - "stacker", -] - -[[package]] -name = "sqlquack-syntax-duckdb" -version = "0.25.0" -source = "git+https://github.com/sqlstack-io/sqlquack.git?rev=9d74b31a8d4cb14aa98d994345d3c90167646c75#9d74b31a8d4cb14aa98d994345d3c90167646c75" -dependencies = [ - "sqlquack-syntax", - "stacker", -] - -[[package]] -name = "sqlquack-syntax-postgres" -version = "0.25.0" -source = "git+https://github.com/sqlstack-io/sqlquack.git?rev=9d74b31a8d4cb14aa98d994345d3c90167646c75#9d74b31a8d4cb14aa98d994345d3c90167646c75" -dependencies = [ - "sqlquack-syntax", - "stacker", -] - -[[package]] -name = "sqlquack-syntax-snowflake" -version = "0.25.0" -source = "git+https://github.com/sqlstack-io/sqlquack.git?rev=9d74b31a8d4cb14aa98d994345d3c90167646c75#9d74b31a8d4cb14aa98d994345d3c90167646c75" -dependencies = [ - "serde", - "serde_json", - "sqlquack-syntax", - "sqlquack-tokenize", - "stacker", - "thiserror 1.0.69", - "unicode-segmentation", -] - -[[package]] -name = "sqlquack-syntax-sqlite" -version = "0.25.0" -source = "git+https://github.com/sqlstack-io/sqlquack.git?rev=9d74b31a8d4cb14aa98d994345d3c90167646c75#9d74b31a8d4cb14aa98d994345d3c90167646c75" -dependencies = [ - "sqlquack-syntax", - "stacker", -] - -[[package]] -name = "sqlquack-syntax-sqlserver" -version = "0.25.0" -source = "git+https://github.com/sqlstack-io/sqlquack.git?rev=9d74b31a8d4cb14aa98d994345d3c90167646c75#9d74b31a8d4cb14aa98d994345d3c90167646c75" -dependencies = [ - "sqlquack-syntax", - "sqlquack-tokenize", - "stacker", -] - -[[package]] -name = "sqlquack-tokenize" -version = "0.25.0" -source = "git+https://github.com/sqlstack-io/sqlquack.git?rev=9d74b31a8d4cb14aa98d994345d3c90167646c75#9d74b31a8d4cb14aa98d994345d3c90167646c75" -dependencies = [ - "sqlquack-syntax", - "thiserror 1.0.69", -] - [[package]] name = "sqlx-core" version = "0.8.6" @@ -7362,7 +7362,7 @@ dependencies = [ "cfg-if", "libc", "psm", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -7945,7 +7945,7 @@ checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" dependencies = [ "memoffset", "tempfile", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -8956,7 +8956,7 @@ dependencies = [ "memchr", "nix 0.31.3", "typed-path", - "windows-sys 0.60.2", + "windows-sys 0.61.2", "zeroize", "zopfli", ] diff --git a/Cargo.toml b/Cargo.toml index f35c632fd0..00a1a2874e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -228,24 +228,24 @@ sqlbuild-scopes = { path = "crates/sqlbuild-scopes" } sqlbuild-sqltext = { path = "crates/sqlbuild-sqltext" } sqlbuild-state = { path = "crates/sqlbuild-state" } # SQL lint Rules, quality Rules and the formatter. -sqlclean = { git = "https://github.com/sqlstack-io/sqlclean.git", rev = "ac9aa4f4f8ef234d4bed3a80dc7e8c1ecac9b81a" } -# SQL change fingerprints over SQLQuack's tokenizers. -sqlquack-fingerprint = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "9d74b31a8d4cb14aa98d994345d3c90167646c75", features = ["bigquery", "databricks", "duckdb", "postgres", "snowflake", "sqlite", "sqlserver"] } +sqlclean = { git = "https://github.com/sqlstack-io/sqlclean.git", rev = "1b54018c4561fbbba7c3dd057e56bdfab641c887" } +# SQL change fingerprints over SQLBabel's tokenizers. +sqlbabel-fingerprint = { git = "https://github.com/sqlstack-io/sqlbabel.git", rev = "b7b8acba57c0a81b173d328cf7e246a927a6dd93", features = ["bigquery", "databricks", "duckdb", "postgres", "snowflake", "sqlite", "sqlserver"] } # Scopes, name resolution, types and lineage for the native analysis route. -sqlquack-semantics = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "9d74b31a8d4cb14aa98d994345d3c90167646c75", features = ["bigquery", "clickhouse", "databricks", "duckdb", "postgres", "snowflake", "sqlite", "sqlserver"] } -# SQLQuack's Snowflake-family parser and tokenizer, reached as SQLQuack exposes them. -sqlquack-parse = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "9d74b31a8d4cb14aa98d994345d3c90167646c75" } -# SQLQuack's syntax tree and lossless tokens. -sqlquack-syntax = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "9d74b31a8d4cb14aa98d994345d3c90167646c75" } -# SQLQuack's tokenizer: lossless tokens and tokenize failures. -sqlquack-tokenize = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "9d74b31a8d4cb14aa98d994345d3c90167646c75" } -sqlquack-syntax-bigquery = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "9d74b31a8d4cb14aa98d994345d3c90167646c75" } -sqlquack-syntax-clickhouse = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "9d74b31a8d4cb14aa98d994345d3c90167646c75" } -sqlquack-syntax-databricks = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "9d74b31a8d4cb14aa98d994345d3c90167646c75" } -sqlquack-syntax-duckdb = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "9d74b31a8d4cb14aa98d994345d3c90167646c75" } -sqlquack-syntax-postgres = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "9d74b31a8d4cb14aa98d994345d3c90167646c75" } -sqlquack-syntax-sqlite = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "9d74b31a8d4cb14aa98d994345d3c90167646c75" } -sqlquack-syntax-sqlserver = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "9d74b31a8d4cb14aa98d994345d3c90167646c75" } +sqlbabel-semantics = { git = "https://github.com/sqlstack-io/sqlbabel.git", rev = "b7b8acba57c0a81b173d328cf7e246a927a6dd93", features = ["bigquery", "clickhouse", "databricks", "duckdb", "postgres", "snowflake", "sqlite", "sqlserver"] } +# SQLBabel's Snowflake-family parser and tokenizer, reached as SQLBabel exposes them. +sqlbabel-parse = { git = "https://github.com/sqlstack-io/sqlbabel.git", rev = "b7b8acba57c0a81b173d328cf7e246a927a6dd93" } +# SQLBabel's syntax tree and lossless tokens. +sqlbabel-syntax = { git = "https://github.com/sqlstack-io/sqlbabel.git", rev = "b7b8acba57c0a81b173d328cf7e246a927a6dd93" } +# SQLBabel's tokenizer: lossless tokens and tokenize failures. +sqlbabel-tokenize = { git = "https://github.com/sqlstack-io/sqlbabel.git", rev = "b7b8acba57c0a81b173d328cf7e246a927a6dd93" } +sqlbabel-syntax-bigquery = { git = "https://github.com/sqlstack-io/sqlbabel.git", rev = "b7b8acba57c0a81b173d328cf7e246a927a6dd93" } +sqlbabel-syntax-clickhouse = { git = "https://github.com/sqlstack-io/sqlbabel.git", rev = "b7b8acba57c0a81b173d328cf7e246a927a6dd93" } +sqlbabel-syntax-databricks = { git = "https://github.com/sqlstack-io/sqlbabel.git", rev = "b7b8acba57c0a81b173d328cf7e246a927a6dd93" } +sqlbabel-syntax-duckdb = { git = "https://github.com/sqlstack-io/sqlbabel.git", rev = "b7b8acba57c0a81b173d328cf7e246a927a6dd93" } +sqlbabel-syntax-postgres = { git = "https://github.com/sqlstack-io/sqlbabel.git", rev = "b7b8acba57c0a81b173d328cf7e246a927a6dd93" } +sqlbabel-syntax-sqlite = { git = "https://github.com/sqlstack-io/sqlbabel.git", rev = "b7b8acba57c0a81b173d328cf7e246a927a6dd93" } +sqlbabel-syntax-sqlserver = { git = "https://github.com/sqlstack-io/sqlbabel.git", rev = "b7b8acba57c0a81b173d328cf7e246a927a6dd93" } stacker = "0.1" # Counts heap allocations in growth tests, which measure work instead of time. stats_alloc = "0.1" diff --git a/Makefile b/Makefile index f1ad5413cf..37c292c972 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ SHELL := /bin/bash -.PHONY: verify verify-quick verify-pg coverage cli-preview rust-check check-native-layering check-parse-guard check-dupes-new check-native-stub check-build-features check-sqlload-release check-python-boundary check-release-gate check-docs-skill check-control-client \ +.PHONY: verify verify-quick verify-pg coverage cli-preview rust-check check-native-layering check-parse-guard check-dupes-new check-native-stub check-build-features check-sqlload-release check-sqlbabel-pin check-python-boundary check-release-gate check-docs-skill check-control-client \ check-e2e-shards check-test-shards test-shard-core test-shard-publication test-shard-history \ test-e2e-duckdb test-e2e-duckdb-build-core \ test-e2e-duckdb-build-incremental \ @@ -760,7 +760,7 @@ verify-quick: exit $$status -check-ci: check-dupes-new check-e2e-shards check-test-shards check-native-layering check-parse-guard check-native-stub check-build-features check-sqlload-release check-python-boundary check-release-gate check-docs-skill check-control-client rust-lint +check-ci: check-dupes-new check-e2e-shards check-test-shards check-native-layering check-parse-guard check-native-stub check-build-features check-sqlload-release check-sqlbabel-pin check-python-boundary check-release-gate check-docs-skill check-control-client rust-lint uv run ruff format --check . uv run ruff check . uv run ty check src tests @@ -791,6 +791,11 @@ check-build-features: uv run python -m scripts.check_build_features +# SQLBabel's Rust crates build from the release tag of the Python package's pinned version. +check-sqlbabel-pin: + uv run python -m scripts.check_sqlbabel_pin + + # A release links SQLLoad from crates.io only; a git pin is for unreleased work on a branch. check-sqlload-release: @if grep -Eq '^sqlload = .*git *=' Cargo.toml; then \ diff --git a/crates/sqlbuild-analysis/Cargo.toml b/crates/sqlbuild-analysis/Cargo.toml index 5fd86ce8d2..2ca53e4dca 100644 --- a/crates/sqlbuild-analysis/Cargo.toml +++ b/crates/sqlbuild-analysis/Cargo.toml @@ -25,18 +25,18 @@ sqlbuild-model-config.workspace = true sqlbuild-render.workspace = true sqlbuild-scopes.workspace = true sqlbuild-sqltext.workspace = true -sqlquack-fingerprint.workspace = true -sqlquack-parse.workspace = true -sqlquack-semantics.workspace = true -sqlquack-syntax.workspace = true -sqlquack-tokenize.workspace = true -sqlquack-syntax-bigquery.workspace = true -sqlquack-syntax-clickhouse.workspace = true -sqlquack-syntax-databricks.workspace = true -sqlquack-syntax-duckdb.workspace = true -sqlquack-syntax-postgres.workspace = true -sqlquack-syntax-sqlite.workspace = true -sqlquack-syntax-sqlserver.workspace = true +sqlbabel-fingerprint.workspace = true +sqlbabel-parse.workspace = true +sqlbabel-semantics.workspace = true +sqlbabel-syntax.workspace = true +sqlbabel-tokenize.workspace = true +sqlbabel-syntax-bigquery.workspace = true +sqlbabel-syntax-clickhouse.workspace = true +sqlbabel-syntax-databricks.workspace = true +sqlbabel-syntax-duckdb.workspace = true +sqlbabel-syntax-postgres.workspace = true +sqlbabel-syntax-sqlite.workspace = true +sqlbabel-syntax-sqlserver.workspace = true stacker.workspace = true [lints] diff --git a/crates/sqlbuild-analysis/src/analysis_route/_helpers/analysis/native_analysis.rs b/crates/sqlbuild-analysis/src/analysis_route/_helpers/analysis/native_analysis.rs index 77333ed2d0..00b42a6ff4 100644 --- a/crates/sqlbuild-analysis/src/analysis_route/_helpers/analysis/native_analysis.rs +++ b/crates/sqlbuild-analysis/src/analysis_route/_helpers/analysis/native_analysis.rs @@ -1,12 +1,12 @@ -//! The provided native analysis: sqlquack-semantics lineage and findings as SQLBuild's facts. +//! The provided native analysis: sqlbabel-semantics lineage and findings as SQLBuild's facts. -use sqlquack_semantics::dialects::types::DialectProfile; -use sqlquack_semantics::lineage::models::{ +use sqlbabel_semantics::dialects::types::DialectProfile; +use sqlbabel_semantics::lineage::models::{ LineageContext, NameFinding, Nullability, OutputLineage, QueryLineage, SourceColumn, TransformKind, }; -use sqlquack_semantics::statement_lineage_and_findings; -use sqlquack_syntax::Expression; +use sqlbabel_semantics::statement_lineage_and_findings; +use sqlbabel_syntax::Expression; use crate::analysis_route::constants::{ ERROR_SEVERITY, UNKNOWN_COLUMN_CODE, UNKNOWN_FUNCTION_CODE, @@ -208,7 +208,7 @@ fn diagnostic_row( }) } -/// An unknown column's message with a quoted name as written, which SQLQuack quotes in lower case. +/// An unknown column's message with a quoted name as written, which SQLBabel quotes in lower case. fn authored_message(finding: &NameFinding) -> String { if finding.code != UNKNOWN_COLUMN_CODE || finding.written.is_empty() { return finding.message.clone(); diff --git a/crates/sqlbuild-analysis/src/analysis_route/_helpers/analysis/native_sharing.rs b/crates/sqlbuild-analysis/src/analysis_route/_helpers/analysis/native_sharing.rs index 19e7f91b1c..b9d8478e24 100644 --- a/crates/sqlbuild-analysis/src/analysis_route/_helpers/analysis/native_sharing.rs +++ b/crates/sqlbuild-analysis/src/analysis_route/_helpers/analysis/native_sharing.rs @@ -6,8 +6,8 @@ use std::hash::{Hash, Hasher}; use rayon::ThreadPool; use rayon::iter::{IntoParallelIterator, IntoParallelRefIterator, ParallelIterator}; use sha2::{Digest, Sha256}; +use sqlbabel_semantics::lineage::models::SchemaColumn; use sqlbuild_core::identifier_text::main::is_lowercase_identifier::is_lowercase_identifier; -use sqlquack_semantics::lineage::models::SchemaColumn; use crate::analysis_route::_helpers::analysis::native_outcome::{ analysed_sql, native_outcome, native_sql, diff --git a/crates/sqlbuild-analysis/src/analysis_route/_helpers/analysis/revalidation.rs b/crates/sqlbuild-analysis/src/analysis_route/_helpers/analysis/revalidation.rs index 6f5bfde6e3..874f13ed3f 100644 --- a/crates/sqlbuild-analysis/src/analysis_route/_helpers/analysis/revalidation.rs +++ b/crates/sqlbuild-analysis/src/analysis_route/_helpers/analysis/revalidation.rs @@ -3,7 +3,7 @@ use std::borrow::Cow; use std::collections::HashMap; -use sqlquack_semantics::lineage::models::{Nullability, SchemaColumn}; +use sqlbabel_semantics::lineage::models::{Nullability, SchemaColumn}; use crate::analysis_route::main::schema_column::schema_column; use crate::analysis_route::models::{AnalysisInput, NativeAnalysis, ParserGap}; diff --git a/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/bigquery_dialect.rs b/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/bigquery_dialect.rs index 2983c3c690..0182f2de7f 100644 --- a/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/bigquery_dialect.rs +++ b/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/bigquery_dialect.rs @@ -1,11 +1,11 @@ -//! BigQuery's native module: SQLQuack's GoogleSQL parser and the BigQuery semantics profile. +//! BigQuery's native module: SQLBabel's GoogleSQL parser and the BigQuery semantics profile. -use sqlquack_semantics::dialects::constants::BIGQUERY; -use sqlquack_semantics::dialects::types::DialectProfile; -use sqlquack_semantics::lineage::models::{NullabilityRule, SchemaColumn}; -use sqlquack_semantics::lineage::types::LineageSchema; -use sqlquack_syntax::{DataType, Expression}; -use sqlquack_syntax_bigquery::{Parsed, StrictFailure, parse_strict}; +use sqlbabel_semantics::dialects::constants::BIGQUERY; +use sqlbabel_semantics::dialects::types::DialectProfile; +use sqlbabel_semantics::lineage::models::{NullabilityRule, SchemaColumn}; +use sqlbabel_semantics::lineage::types::LineageSchema; +use sqlbabel_syntax::{DataType, Expression}; +use sqlbabel_syntax_bigquery::{Parsed, StrictFailure, parse_strict}; use crate::analysis_route::_helpers::analysis::native_analysis::native_analysis; use crate::analysis_route::_helpers::dialects::engine_types::bigquery_engine_type; diff --git a/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/clickhouse_dialect.rs b/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/clickhouse_dialect.rs index 213e973102..25aadfcac9 100644 --- a/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/clickhouse_dialect.rs +++ b/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/clickhouse_dialect.rs @@ -1,9 +1,9 @@ -//! ClickHouse's native module: SQLQuack's ClickHouse parser, profile and type spellings. +//! ClickHouse's native module: SQLBabel's ClickHouse parser, profile and type spellings. -use sqlquack_semantics::dialects::constants::CLICKHOUSE; -use sqlquack_semantics::dialects::types::DialectProfile; -use sqlquack_syntax::Parsed; -use sqlquack_syntax_clickhouse::parse_strict; +use sqlbabel_semantics::dialects::constants::CLICKHOUSE; +use sqlbabel_semantics::dialects::types::DialectProfile; +use sqlbabel_syntax::Parsed; +use sqlbabel_syntax_clickhouse::parse_strict; use crate::analysis_route::_helpers::dialects::clickhouse_types::{ clickhouse_spelling, clickhouse_type, clickhouse_type_match, diff --git a/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/databricks_dialect.rs b/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/databricks_dialect.rs index d83be763ce..23de44a34a 100644 --- a/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/databricks_dialect.rs +++ b/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/databricks_dialect.rs @@ -1,9 +1,9 @@ -//! Databricks' native module: SQLQuack's Databricks SQL parser and the Databricks semantics profile. +//! Databricks' native module: SQLBabel's Databricks SQL parser and the Databricks semantics profile. -use sqlquack_semantics::dialects::constants::DATABRICKS; -use sqlquack_semantics::dialects::types::DialectProfile; -use sqlquack_syntax::{DataType, Expression}; -use sqlquack_syntax_databricks::{Parsed, StrictFailure, parse_strict}; +use sqlbabel_semantics::dialects::constants::DATABRICKS; +use sqlbabel_semantics::dialects::types::DialectProfile; +use sqlbabel_syntax::{DataType, Expression}; +use sqlbabel_syntax_databricks::{Parsed, StrictFailure, parse_strict}; use crate::analysis_route::_helpers::dialects::type_spelling::family_session_type; use crate::analysis_route::constants::{ diff --git a/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/duckdb_dialect.rs b/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/duckdb_dialect.rs index cfd466d9be..d1dfddfb78 100644 --- a/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/duckdb_dialect.rs +++ b/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/duckdb_dialect.rs @@ -1,8 +1,8 @@ -//! DuckDB's native module: SQLQuack's native DuckDB parser reads its SQL. Validation only. +//! DuckDB's native module: SQLBabel's native DuckDB parser reads its SQL. Validation only. -use sqlquack_semantics::dialects::constants::DUCKDB; -use sqlquack_semantics::dialects::types::DialectProfile; -use sqlquack_syntax_duckdb::{Parsed, StrictFailure, parse_strict}; +use sqlbabel_semantics::dialects::constants::DUCKDB; +use sqlbabel_semantics::dialects::types::DialectProfile; +use sqlbabel_syntax_duckdb::{Parsed, StrictFailure, parse_strict}; use crate::analysis_route::_helpers::dialects::engine_types::duckdb_engine_type; use crate::analysis_route::_helpers::dialects::type_spelling::respelt; diff --git a/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/postgres_dialect.rs b/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/postgres_dialect.rs index 2160d4f736..60b3768c60 100644 --- a/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/postgres_dialect.rs +++ b/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/postgres_dialect.rs @@ -1,8 +1,8 @@ -//! PostgreSQL's native module: SQLQuack's PostgreSQL 18 parser reads its SQL. +//! PostgreSQL's native module: SQLBabel's PostgreSQL 18 parser reads its SQL. -use sqlquack_semantics::dialects::constants::POSTGRES; -use sqlquack_semantics::dialects::types::DialectProfile; -use sqlquack_syntax_postgres::{Parsed, StrictFailure, format_type, parse_strict, parse_type}; +use sqlbabel_semantics::dialects::constants::POSTGRES; +use sqlbabel_semantics::dialects::types::DialectProfile; +use sqlbabel_syntax_postgres::{Parsed, StrictFailure, format_type, parse_strict, parse_type}; use crate::analysis_route::constants::{ POSTGRES_DIALECT, POSTGRES_TEMPORAL_PRECISION, POSTGRES_TEMPORAL_SPELLINGS, diff --git a/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/snowflake_dialect.rs b/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/snowflake_dialect.rs index d4389dc1e4..7d16165b58 100644 --- a/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/snowflake_dialect.rs +++ b/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/snowflake_dialect.rs @@ -1,12 +1,12 @@ -//! Snowflake's native module: SQLQuack's Snowflake parser reads its SQL. Validation only. +//! Snowflake's native module: SQLBabel's Snowflake parser reads its SQL. Validation only. use std::num::IntErrorKind; -use sqlquack_parse::{StrictFailure, parse_strict}; -use sqlquack_semantics::dialects::constants::{SNOWFLAKE, SNOWFLAKE_QUOTED_IGNORING_CASE}; -use sqlquack_semantics::dialects::types::DialectProfile; -use sqlquack_syntax::{Dialect, Error, Expression, Parsed}; -use sqlquack_tokenize::TokenizeFailure; +use sqlbabel_parse::{StrictFailure, parse_strict}; +use sqlbabel_semantics::dialects::constants::{SNOWFLAKE, SNOWFLAKE_QUOTED_IGNORING_CASE}; +use sqlbabel_semantics::dialects::types::DialectProfile; +use sqlbabel_syntax::{Dialect, Error, Expression, Parsed}; +use sqlbabel_tokenize::TokenizeFailure; use crate::analysis_route::_helpers::dialects::engine_types::snowflake_engine_type; use crate::analysis_route::_helpers::dialects::type_spelling::respelt; @@ -16,7 +16,7 @@ use crate::analysis_route::constants::{ }; use crate::analysis_route::models::{AnalysisInput, ParserGap, SnowflakeDialect}; use crate::analysis_route::types::NativeDialect; -use crate::parse_guard::main::sqlquack_parse_options::sqlquack_parse_options; +use crate::parse_guard::main::sqlbabel_parse_options::sqlbabel_parse_options; use crate::type_system::main::normalize_text_type::normalize_text_type; use crate::type_system::models::{NormalizedType, PythonInteger, TypeDialect, TypeFamily}; @@ -101,7 +101,7 @@ fn snowflake_timestamp(spelling: &str) -> Option> { /// Every statement the shared parser reads from `sql`, or its first refusal, never marked syntax. pub(crate) fn shared_parsed(sql: &str, dialect: Dialect) -> Result { - let statements: Vec = parse_strict(sql, dialect, &sqlquack_parse_options()) + let statements: Vec = parse_strict(sql, dialect, &sqlbabel_parse_options()) .map_err(|failure| match failure { StrictFailure::Tokens( TokenizeFailure::Uncovered { start, .. } | TokenizeFailure::Overlap { start, .. }, diff --git a/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/sqlite_dialect.rs b/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/sqlite_dialect.rs index 83ba6580be..a0a5f34ee5 100644 --- a/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/sqlite_dialect.rs +++ b/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/sqlite_dialect.rs @@ -1,8 +1,8 @@ -//! SQLite's native module: SQLQuack's native SQLite parser reads its SQL. Validation only. +//! SQLite's native module: SQLBabel's native SQLite parser reads its SQL. Validation only. -use sqlquack_semantics::dialects::constants::SQLITE; -use sqlquack_semantics::dialects::types::DialectProfile; -use sqlquack_syntax_sqlite::{Parsed, StrictFailure, parse_strict}; +use sqlbabel_semantics::dialects::constants::SQLITE; +use sqlbabel_semantics::dialects::types::DialectProfile; +use sqlbabel_syntax_sqlite::{Parsed, StrictFailure, parse_strict}; use crate::analysis_route::_helpers::dialects::type_spelling::respelt; use crate::analysis_route::constants::{ diff --git a/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/tsql_dialect.rs b/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/tsql_dialect.rs index a8e2fb4ed2..478e18a9dd 100644 --- a/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/tsql_dialect.rs +++ b/crates/sqlbuild-analysis/src/analysis_route/_helpers/dialects/tsql_dialect.rs @@ -1,9 +1,9 @@ -//! SQL Server's native module: SQLQuack's T-SQL parser and its sqlquack-semantics profile. +//! SQL Server's native module: SQLBabel's T-SQL parser and its sqlbabel-semantics profile. -use sqlquack_semantics::dialects::constants::SQL_SERVER; -use sqlquack_semantics::dialects::types::DialectProfile; -use sqlquack_syntax::{DataType, Expression, Gap, Parsed}; -use sqlquack_syntax_sqlserver::parse_strict; +use sqlbabel_semantics::dialects::constants::SQL_SERVER; +use sqlbabel_semantics::dialects::types::DialectProfile; +use sqlbabel_syntax::{DataType, Expression, Gap, Parsed}; +use sqlbabel_syntax_sqlserver::parse_strict; use crate::analysis_route::_helpers::dialects::engine_types::tsql_engine_type; use crate::analysis_route::constants::{ diff --git a/crates/sqlbuild-analysis/src/analysis_route/main/fast_lineage.rs b/crates/sqlbuild-analysis/src/analysis_route/main/fast_lineage.rs index 598d9e5dd6..58498eb529 100644 --- a/crates/sqlbuild-analysis/src/analysis_route/main/fast_lineage.rs +++ b/crates/sqlbuild-analysis/src/analysis_route/main/fast_lineage.rs @@ -2,9 +2,9 @@ use std::collections::HashMap; +use sqlbabel_semantics::lineage::models::{Nullability, SchemaColumn}; use sqlbuild_sqltext::compiler::main::placeholder_defaults::placeholder_defaults; use sqlbuild_sqltext::sql_scan::main::dialect_lexical_syntax::dialect_lexical_syntax; -use sqlquack_semantics::lineage::models::{Nullability, SchemaColumn}; use crate::analysis_route::_helpers::analysis::located_gap::{located, unreadable_reason}; use crate::analysis_route::_helpers::analysis::marker_names::{distinct_calls, first_call_names}; diff --git a/crates/sqlbuild-analysis/src/analysis_route/main/schema_column.rs b/crates/sqlbuild-analysis/src/analysis_route/main/schema_column.rs index d2a89894a0..681447faa4 100644 --- a/crates/sqlbuild-analysis/src/analysis_route/main/schema_column.rs +++ b/crates/sqlbuild-analysis/src/analysis_route/main/schema_column.rs @@ -1,8 +1,8 @@ -use sqlquack_semantics::lineage::models::{Nullability, SchemaColumn}; +use sqlbabel_semantics::lineage::models::{Nullability, SchemaColumn}; use crate::assembly::analysis_session::constants::QUOTED_IDENTIFIER_DELIMITER; -/// A stored column name as SQLQuack reads it: `"…"` is quoted, its inner `""` one quote. +/// A stored column name as SQLBabel reads it: `"…"` is quoted, its inner `""` one quote. #[must_use] pub fn schema_column( name: &str, diff --git a/crates/sqlbuild-analysis/src/analysis_route/mod.rs b/crates/sqlbuild-analysis/src/analysis_route/mod.rs index de4f77e0d4..7c89678faa 100644 --- a/crates/sqlbuild-analysis/src/analysis_route/mod.rs +++ b/crates/sqlbuild-analysis/src/analysis_route/mod.rs @@ -1,4 +1,4 @@ -//! Which native module analyses a dialect's SQL over SQLQuack, if any does. +//! Which native module analyses a dialect's SQL over SQLBabel, if any does. pub(crate) mod _helpers; pub(crate) mod constants; diff --git a/crates/sqlbuild-analysis/src/analysis_route/models.rs b/crates/sqlbuild-analysis/src/analysis_route/models.rs index dc1a5c750e..5abdb67482 100644 --- a/crates/sqlbuild-analysis/src/analysis_route/models.rs +++ b/crates/sqlbuild-analysis/src/analysis_route/models.rs @@ -1,7 +1,7 @@ //! The route a dialect's analysis takes, and what stops a native parser reading SQL whole. -use sqlquack_semantics::lineage::models::{Nullability, SchemaColumn}; -use sqlquack_semantics::lineage::types::LineageSchema; +use sqlbabel_semantics::lineage::models::{Nullability, SchemaColumn}; +use sqlbabel_semantics::lineage::types::LineageSchema; use crate::analysis_route::types::NativeDialect; use crate::assembly::analysis_session::models::{ColumnFact, LineageRow}; @@ -148,7 +148,7 @@ impl LineageSchema for StandInSchema { } } -/// BigQuery, whose SQL SQLQuack's GoogleSQL parser reads. +/// BigQuery, whose SQL SQLBabel's GoogleSQL parser reads. #[derive(Clone, Copy, Debug)] pub struct BigQueryDialect; @@ -158,11 +158,11 @@ pub(crate) struct BigQueryTypes<'a> { pub(crate) schema: &'a dyn LineageSchema, } -/// ClickHouse, whose SQL SQLQuack's ClickHouse parser reads. +/// ClickHouse, whose SQL SQLBabel's ClickHouse parser reads. #[derive(Clone, Copy, Debug)] pub struct ClickHouseDialect; -/// Databricks, whose SQL SQLQuack's Databricks SQL parser reads. +/// Databricks, whose SQL SQLBabel's Databricks SQL parser reads. #[derive(Clone, Copy, Debug)] pub struct DatabricksDialect; @@ -170,15 +170,15 @@ pub struct DatabricksDialect; #[derive(Clone, Copy, Debug)] pub struct DuckDbDialect; -/// PostgreSQL, whose SQL SQLQuack's PostgreSQL 18 parser reads. +/// PostgreSQL, whose SQL SQLBabel's PostgreSQL 18 parser reads. #[derive(Clone, Copy, Debug)] pub struct PostgresDialect; -/// Snowflake, whose SQL SQLQuack's Snowflake parser reads. +/// Snowflake, whose SQL SQLBabel's Snowflake parser reads. #[derive(Clone, Copy, Debug)] pub struct SnowflakeDialect; -/// SQLite, whose SQL SQLQuack's native SQLite parser reads. +/// SQLite, whose SQL SQLBabel's native SQLite parser reads. #[derive(Clone, Copy, Debug)] pub struct SqliteDialect; @@ -203,7 +203,7 @@ pub struct TypeSpelling { pub arrays: bool, } -/// SQL Server, whose SQL SQLQuack's T-SQL parser reads. +/// SQL Server, whose SQL SQLBabel's T-SQL parser reads. #[derive(Clone, Copy, Debug)] pub struct TsqlDialect; diff --git a/crates/sqlbuild-analysis/src/analysis_route/tests/helpers.rs b/crates/sqlbuild-analysis/src/analysis_route/tests/helpers.rs index 84fededf40..c6ae7cf5b8 100644 --- a/crates/sqlbuild-analysis/src/analysis_route/tests/helpers.rs +++ b/crates/sqlbuild-analysis/src/analysis_route/tests/helpers.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; +use sqlbabel_semantics::lineage::models::{Nullability, SchemaColumn}; use sqlbuild_attachments::cursor_intrinsics::main::replace_intrinsics_with_spans::replace_intrinsics_with_spans; -use sqlquack_semantics::lineage::models::{Nullability, SchemaColumn}; use crate::analysis_route::_helpers::analysis::native_outcome::{ analysed_sql, native_outcome, native_sql, diff --git a/crates/sqlbuild-analysis/src/analysis_route/tests/test_native_gap.rs b/crates/sqlbuild-analysis/src/analysis_route/tests/test_native_gap.rs index bd34845e54..9da598e888 100644 --- a/crates/sqlbuild-analysis/src/analysis_route/tests/test_native_gap.rs +++ b/crates/sqlbuild-analysis/src/analysis_route/tests/test_native_gap.rs @@ -58,7 +58,7 @@ fn given_a_dialect_when_routing_analysis_then_a_native_module_or_nothing_analyse expected_module: Some("bigquery"), }, RouteTestCase { - description: "databricks, read by SQLQuack's Databricks SQL parser", + description: "databricks, read by SQLBabel's Databricks SQL parser", dialect: Some("databricks"), expected_module: Some("databricks"), }, diff --git a/crates/sqlbuild-analysis/src/analysis_route/tests/test_native_outcome.rs b/crates/sqlbuild-analysis/src/analysis_route/tests/test_native_outcome.rs index 2b90c73f7f..bd86cbe5ba 100644 --- a/crates/sqlbuild-analysis/src/analysis_route/tests/test_native_outcome.rs +++ b/crates/sqlbuild-analysis/src/analysis_route/tests/test_native_outcome.rs @@ -12,7 +12,7 @@ use crate::assembly::analysis_session::types::Shapes; use crate::lineage::models::{ LineageColumn, LineageOutcomeParts, LineageResourceType, LineageSchemaResource, }; -use sqlquack_semantics::lineage::models::{Nullability, NullabilityRule}; +use sqlbabel_semantics::lineage::models::{Nullability, NullabilityRule}; #[test] fn given_session_shapes_when_a_native_route_analyses_a_model_then_its_facts_follow_them() { diff --git a/crates/sqlbuild-analysis/src/analysis_route/tests/test_types.rs b/crates/sqlbuild-analysis/src/analysis_route/tests/test_types.rs index 55038bb47d..2bf871b9fe 100644 --- a/crates/sqlbuild-analysis/src/analysis_route/tests/test_types.rs +++ b/crates/sqlbuild-analysis/src/analysis_route/tests/test_types.rs @@ -1,9 +1,9 @@ -use sqlquack_parse::parse_strict; -use sqlquack_semantics::dialects::constants::{DUCKDB, POSTGRES, SNOWFLAKE}; -use sqlquack_semantics::dialects::types::DialectProfile; -use sqlquack_semantics::lineage::models::{Nullability, NullabilityRule}; -use sqlquack_syntax::expressions::statements::models::Command; -use sqlquack_syntax::{Dialect, Expression, ParseOptions, Parsed}; +use sqlbabel_parse::parse_strict; +use sqlbabel_semantics::dialects::constants::{DUCKDB, POSTGRES, SNOWFLAKE}; +use sqlbabel_semantics::dialects::types::DialectProfile; +use sqlbabel_semantics::lineage::models::{Nullability, NullabilityRule}; +use sqlbabel_syntax::expressions::statements::models::Command; +use sqlbabel_syntax::{Dialect, Expression, ParseOptions, Parsed}; use crate::analysis_route::models::{AnalysisRoute, GapSite, LocatedGap, ParserGap, TypeMatch}; use crate::analysis_route::types::NativeDialect; @@ -67,7 +67,7 @@ impl NativeDialect for PivotlessDialect { syntax: false, }); } - sqlquack_syntax_postgres::parse(sql).map_err(|error| ParserGap { + sqlbabel_syntax_postgres::parse(sql).map_err(|error| ParserGap { construct: error.message.clone(), message: error.message, offset: error.position, diff --git a/crates/sqlbuild-analysis/src/analysis_route/types.rs b/crates/sqlbuild-analysis/src/analysis_route/types.rs index 1797371098..4b98ee1deb 100644 --- a/crates/sqlbuild-analysis/src/analysis_route/types.rs +++ b/crates/sqlbuild-analysis/src/analysis_route/types.rs @@ -1,7 +1,7 @@ //! What a dialect's native analysis module provides. -use sqlquack_semantics::dialects::types::DialectProfile; -use sqlquack_syntax::{Expression, Parsed}; +use sqlbabel_semantics::dialects::types::DialectProfile; +use sqlbabel_syntax::{Expression, Parsed}; use crate::analysis_route::_helpers::analysis::native_analysis::native_analysis; use crate::analysis_route::_helpers::analysis::whole_gap::whole_gap; @@ -14,7 +14,7 @@ use crate::assembly::analysis_session::models::SessionSchema; use crate::assembly::analysis_session::types::Shapes; use crate::type_system::models::NormalizedType; -/// A dialect whose SQL SQLQuack analyses in place of Polyglot. +/// A dialect whose SQL SQLBabel analyses in place of Polyglot. pub trait NativeDialect: Sync { /// The adapter's analysis dialect name, such as `postgres`. fn name(&self) -> &'static str; @@ -25,7 +25,7 @@ pub trait NativeDialect: Sync { /// Every statement of `sql` with the parser's named gaps, or the first error that stops it. fn parse(&self, sql: &str) -> Result; - /// The dialect's sqlquack-semantics profile: how its names resolve, compare and type. + /// The dialect's sqlbabel-semantics profile: how its names resolve, compare and type. fn profile(&self) -> &'static dyn DialectProfile; /// The profile `input` is analysed under; a dialect whose name rules follow a setting overrides it. diff --git a/crates/sqlbuild-analysis/src/assembly/analysis_session/_helpers/catalog_state.rs b/crates/sqlbuild-analysis/src/assembly/analysis_session/_helpers/catalog_state.rs index a1e3c8acd3..3dddfbc51d 100644 --- a/crates/sqlbuild-analysis/src/assembly/analysis_session/_helpers/catalog_state.rs +++ b/crates/sqlbuild-analysis/src/assembly/analysis_session/_helpers/catalog_state.rs @@ -2,7 +2,7 @@ use std::collections::{HashMap, HashSet}; -use sqlquack_semantics::lineage::models::SchemaColumn; +use sqlbabel_semantics::lineage::models::SchemaColumn; use crate::assembly::analysis_session::_helpers::compact_batch::{MemoKey, SharedResult}; use crate::assembly::analysis_session::_helpers::mappings::{ diff --git a/crates/sqlbuild-analysis/src/assembly/analysis_session/_helpers/dynamic_pivot.rs b/crates/sqlbuild-analysis/src/assembly/analysis_session/_helpers/dynamic_pivot.rs index c6ac5aaec3..af78f62cc1 100644 --- a/crates/sqlbuild-analysis/src/assembly/analysis_session/_helpers/dynamic_pivot.rs +++ b/crates/sqlbuild-analysis/src/assembly/analysis_session/_helpers/dynamic_pivot.rs @@ -5,10 +5,10 @@ use std::collections::{HashMap, HashSet}; use rayon::ThreadPool; use rayon::iter::{IntoParallelRefIterator, ParallelIterator}; use serde_json::{Map, Value}; +use sqlbabel_syntax::{CallMode, Dialect, Expression}; use sqlbuild_core::panics::main::catch_compiler_panic::catch_compiler_panic; use sqlbuild_core::panics::main::native_failure::native_failure; use sqlbuild_sqltext::sql_scan::main::dialect_lexical_syntax::dialect_lexical_syntax; -use sqlquack_syntax::{CallMode, Dialect, Expression}; use crate::assembly::analysis_session::_helpers::dict_walk::{ casefold, column_name, dict_list, identifier_name, is_single_wildcard, nested, node_key, @@ -25,7 +25,7 @@ use crate::assembly::analysis_session::models::{ ColumnFact, ContractProof, DynamicFamily, PivotModel, PivotOutcome, PivotTables, }; use crate::assembly::analysis_session::types::Shapes; -use crate::parse_guard::main::sqlquack_parse_options::sqlquack_parse_options; +use crate::parse_guard::main::sqlbabel_parse_options::sqlbabel_parse_options; use crate::relation_markers::constants::MARKER_NAME_PREFIX; use crate::relation_markers::main::markers_as_names::markers_as_names; use crate::relation_markers::types::MarkerCall; @@ -124,7 +124,7 @@ pub(crate) fn pivot_outcome( .map_err(|reason| native_failure(PIVOT_CONTEXT, &reason)) } -/// The one statement of `sql` as SQLQuack's tagged JSON tree, marker relations as their names. +/// The one statement of `sql` as SQLBabel's tagged JSON tree, marker relations as their names. fn parsed(sql: &str, dialect: &str) -> Result, String> { let (lexical_dialect, dialect): (&str, Dialect) = if dialect == SNOWFLAKE_DIALECT { (SNOWFLAKE_DIALECT, Dialect::Snowflake) @@ -132,10 +132,10 @@ fn parsed(sql: &str, dialect: &str) -> Result, String> { (DUCKDB_DIALECT, Dialect::DuckDB) }; let (named, calls) = markers_as_names(sql, &dialect_lexical_syntax(lexical_dialect))?; - let parsed = sqlquack_parse::parse_statements_with( + let parsed = sqlbabel_parse::parse_statements_with( &named, dialect, - &sqlquack_parse_options(), + &sqlbabel_parse_options(), CallMode::Faithful, ); let mut statements: Vec = match parsed { @@ -441,7 +441,7 @@ fn has_dynamic_values(field: &Value) -> bool { .any(|value| DYNAMIC_VALUE_SOURCE_KINDS.contains(&node_key(Some(value)))) } -/// The one argument of a call SQLQuack keeps by name, such as Snowflake's `SUM(amount)`. +/// The one argument of a call SQLBabel keeps by name, such as Snowflake's `SUM(amount)`. fn sole_argument(payload: &Map) -> Option<&Value> { match payload .get("args") diff --git a/crates/sqlbuild-analysis/src/assembly/analysis_session/_helpers/mappings.rs b/crates/sqlbuild-analysis/src/assembly/analysis_session/_helpers/mappings.rs index ab7f3b35a4..2df888620d 100644 --- a/crates/sqlbuild-analysis/src/assembly/analysis_session/_helpers/mappings.rs +++ b/crates/sqlbuild-analysis/src/assembly/analysis_session/_helpers/mappings.rs @@ -4,7 +4,7 @@ use std::collections::{BTreeSet, HashMap}; use std::sync::OnceLock; use sha2::{Digest, Sha256}; -use sqlquack_semantics::lineage::models::{Nullability, NullabilityRule, SchemaColumn}; +use sqlbabel_semantics::lineage::models::{Nullability, NullabilityRule, SchemaColumn}; use crate::analysis_route::main::schema_column::schema_column; use crate::analysis_route::types::NativeDialect; diff --git a/crates/sqlbuild-analysis/src/assembly/analysis_session/models.rs b/crates/sqlbuild-analysis/src/assembly/analysis_session/models.rs index 928a8cb371..34bbbac2c0 100644 --- a/crates/sqlbuild-analysis/src/assembly/analysis_session/models.rs +++ b/crates/sqlbuild-analysis/src/assembly/analysis_session/models.rs @@ -5,10 +5,10 @@ use std::fmt; use std::sync::Arc; use rayon::ThreadPool; +use sqlbabel_semantics::lineage::models::{NullabilityRule, SchemaColumn}; +use sqlbabel_semantics::lineage::types::LineageSchema; use sqlbuild_cache::digest::types::ContentDigest; use sqlbuild_cache::store::models::NativeStore; -use sqlquack_semantics::lineage::models::{NullabilityRule, SchemaColumn}; -use sqlquack_semantics::lineage::types::LineageSchema; use crate::assembly::analysis_session::_helpers::catalog_state::{ SessionCatalog, relation_columns, @@ -361,7 +361,7 @@ pub struct AnalysisCache { pub(crate) stats: AnalysisCacheStats, } -/// The adapter's function facts a native route gives SQLQuack: return types and nullability rules. +/// The adapter's function facts a native route gives SQLBabel: return types and nullability rules. #[derive(Clone, Debug, Default)] pub(crate) struct SessionFunctions { /// `(function name, type)` of each function whose return type the adapter declares. diff --git a/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/check_independence.rs b/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/check_independence.rs index 431bc1ea8d..5036575474 100644 --- a/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/check_independence.rs +++ b/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/check_independence.rs @@ -5,9 +5,9 @@ use std::collections::{BTreeSet, HashMap}; use sqlbuild_core::graph_walk::main::breadth_first_path::breadth_first_path; use serde_json::Value; +use sqlbabel_syntax::{Expression, ExpressionWalk, Parsed}; use sqlbuild_sqltext::sql_scan::main::dialect_non_code_end::dialect_non_code_end; use sqlbuild_sqltext::sql_scan::models::{LexicalSyntax, Unclosed}; -use sqlquack_syntax::{Expression, ExpressionWalk, Parsed}; use crate::analysis_route::types::NativeDialect; use crate::compiler::constants::{ALIAS_FIELD, CTES_FIELD, NAME_FIELD}; diff --git a/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/expected_columns.rs b/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/expected_columns.rs index 2db0bf0384..1c3f102bca 100644 --- a/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/expected_columns.rs +++ b/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/expected_columns.rs @@ -3,10 +3,10 @@ use std::collections::{BTreeMap, HashSet}; use serde_json::json; +use sqlbabel_syntax::expressions::names::models::Identifier; +use sqlbabel_syntax::expressions::queries::models::Select; +use sqlbabel_syntax::{Expression, Parsed}; use sqlbuild_sqltext::sql_scan::models::LexicalSyntax; -use sqlquack_syntax::expressions::names::models::Identifier; -use sqlquack_syntax::expressions::queries::models::Select; -use sqlquack_syntax::{Expression, Parsed}; use crate::analysis_route::types::NativeDialect; use crate::compiler::_helpers::sql_tests::extraction::{ diff --git a/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/helper_names.rs b/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/helper_names.rs index b31844252c..ce5c301b16 100644 --- a/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/helper_names.rs +++ b/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/helper_names.rs @@ -2,7 +2,7 @@ use std::collections::{HashMap, HashSet}; -use sqlquack_syntax::{Expression, ExpressionWalk, Parsed}; +use sqlbabel_syntax::{Expression, ExpressionWalk, Parsed}; use crate::analysis_route::types::NativeDialect; diff --git a/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/mock_reads.rs b/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/mock_reads.rs index aace735a9e..7401f4b76d 100644 --- a/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/mock_reads.rs +++ b/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/mock_reads.rs @@ -3,6 +3,8 @@ use std::collections::HashSet; use std::convert::Infallible; +use sqlbabel_syntax::expressions::queries::models::With; +use sqlbabel_syntax::{Expression, ExpressionWalk, Parsed}; use sqlbuild_core::graph_walk::main::breadth_first_reach::breadth_first_reach; use sqlbuild_core::graph_walk::models::VisitOrder; use sqlbuild_core::graph_walk::types::NodeSet; @@ -11,8 +13,6 @@ use sqlbuild_core::text::main::is_word_char::is_word_char; use sqlbuild_sqltext::sql_references::main::extract_sql_references::extract_sql_references; use sqlbuild_sqltext::sql_references::models::{ReferenceExtraction, SqlReference}; use sqlbuild_sqltext::sql_scan::models::LexicalSyntax; -use sqlquack_syntax::expressions::queries::models::With; -use sqlquack_syntax::{Expression, ExpressionWalk, Parsed}; use crate::analysis_route::types::NativeDialect; use crate::compiler::_helpers::sql_tests::planning::MOCK_CTE_PREFIXES; diff --git a/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/planning.rs b/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/planning.rs index 3d9514ce6e..f42ad7f7ce 100644 --- a/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/planning.rs +++ b/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/planning.rs @@ -9,9 +9,9 @@ use rayon::iter::{IntoParallelIterator, ParallelIterator}; use regex::Regex; #[cfg(test)] use serde::Serialize; +use sqlbabel_syntax::{Expression, Parsed}; use sqlbuild_core::graph_walk::main::breadth_first_reach::breadth_first_reach; use sqlbuild_core::graph_walk::main::depth_first_postorder::depth_first_postorder; -use sqlquack_syntax::{Expression, Parsed}; use crate::analysis_route::types::NativeDialect; use crate::compiler::_helpers::sql_tests::cte_rename::defined_cte_keys; diff --git a/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/relation_markers.rs b/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/relation_markers.rs index c715d67e6c..795fcc1e98 100644 --- a/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/relation_markers.rs +++ b/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/relation_markers.rs @@ -1,7 +1,7 @@ //! Relation marker calls in a serialized pre-order walk of a parsed statement's relations. -use sqlquack_syntax::expressions::queries::models::{From, Join}; -use sqlquack_syntax::{Expression, ExpressionWalk}; +use sqlbabel_syntax::expressions::queries::models::{From, Join}; +use sqlbabel_syntax::{Expression, ExpressionWalk}; use crate::compiler::_helpers::sql_tests::planning::DBT_REF_FUNCTION; use crate::relation_markers::constants::MARKER_NAME_PREFIX; diff --git a/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/simple_template.rs b/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/simple_template.rs index bee5dc4d03..2239af134d 100644 --- a/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/simple_template.rs +++ b/crates/sqlbuild-analysis/src/compiler/_helpers/sql_tests/simple_template.rs @@ -2,9 +2,9 @@ use std::collections::HashSet; -use sqlquack_parse::dialect_tokens; -use sqlquack_syntax::Dialect; -use sqlquack_syntax::tokens::models::{Token, TokenType}; +use sqlbabel_parse::dialect_tokens; +use sqlbabel_syntax::Dialect; +use sqlbabel_syntax::tokens::models::{Token, TokenType}; use crate::compiler::_helpers::sql_tests::planning::{AnalysisTemplate, SqlTestPatterns}; use crate::relation_markers::constants::MARKER_NAME_PREFIX; diff --git a/crates/sqlbuild-analysis/src/compiler/tests/simple_template/helpers.rs b/crates/sqlbuild-analysis/src/compiler/tests/simple_template/helpers.rs index e2c2f051ff..dbe31f5896 100644 --- a/crates/sqlbuild-analysis/src/compiler/tests/simple_template/helpers.rs +++ b/crates/sqlbuild-analysis/src/compiler/tests/simple_template/helpers.rs @@ -1,6 +1,6 @@ +use sqlbabel_parse::dialect_tokens; +use sqlbabel_syntax::Dialect; use sqlbuild_sqltext::sql_scan::models::LexicalSyntax; -use sqlquack_parse::dialect_tokens; -use sqlquack_syntax::Dialect; use crate::compiler::_helpers::sql_tests::planning::{ AnalysisTemplate, SqlTestPatterns, parsed_analysis_template, diff --git a/crates/sqlbuild-analysis/src/compiler/tests/test_sql_test_simple_template.rs b/crates/sqlbuild-analysis/src/compiler/tests/test_sql_test_simple_template.rs index 3730b1b470..15de11d11b 100644 --- a/crates/sqlbuild-analysis/src/compiler/tests/test_sql_test_simple_template.rs +++ b/crates/sqlbuild-analysis/src/compiler/tests/test_sql_test_simple_template.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use std::sync::Mutex; -use sqlquack_syntax::Dialect; +use sqlbabel_syntax::Dialect; use crate::compiler::_helpers::sql_tests::planning::{analysis_template, parsed_analysis_template}; use crate::compiler::_helpers::sql_tests::rendering::sql_test_parser; diff --git a/crates/sqlbuild-analysis/src/compiler/tests/test_types.rs b/crates/sqlbuild-analysis/src/compiler/tests/test_types.rs index ae7da44553..bd2823d468 100644 --- a/crates/sqlbuild-analysis/src/compiler/tests/test_types.rs +++ b/crates/sqlbuild-analysis/src/compiler/tests/test_types.rs @@ -1,6 +1,6 @@ use crate::compiler::_helpers::sql_tests::expected_columns::UnreadableColumns; +use sqlbabel_syntax::Dialect; use sqlbuild_sqltext::sql_scan::models::Unclosed; -use sqlquack_syntax::Dialect; pub(crate) struct SqlTestExtractionTestCase { pub(crate) description: &'static str, diff --git a/crates/sqlbuild-analysis/src/parse_guard/main/mod.rs b/crates/sqlbuild-analysis/src/parse_guard/main/mod.rs index 793cfb6cd0..aa7cd4646a 100644 --- a/crates/sqlbuild-analysis/src/parse_guard/main/mod.rs +++ b/crates/sqlbuild-analysis/src/parse_guard/main/mod.rs @@ -1,3 +1,3 @@ pub mod polyglot_complexity_guard; pub mod polyglot_parse_options; -pub mod sqlquack_parse_options; +pub mod sqlbabel_parse_options; diff --git a/crates/sqlbuild-analysis/src/parse_guard/main/sqlquack_parse_options.rs b/crates/sqlbuild-analysis/src/parse_guard/main/sqlbabel_parse_options.rs similarity index 54% rename from crates/sqlbuild-analysis/src/parse_guard/main/sqlquack_parse_options.rs rename to crates/sqlbuild-analysis/src/parse_guard/main/sqlbabel_parse_options.rs index 7feafefee6..8952271f3a 100644 --- a/crates/sqlbuild-analysis/src/parse_guard/main/sqlquack_parse_options.rs +++ b/crates/sqlbuild-analysis/src/parse_guard/main/sqlbabel_parse_options.rs @@ -1,12 +1,12 @@ -//! `sqlquack_parse_options`: the options every SQLBuild SQLQuack parse passes. +//! `sqlbabel_parse_options`: the options every SQLBuild SQLBabel parse passes. -use sqlquack_syntax::{ComplexityGuardOptions, ParseOptions}; +use sqlbabel_syntax::{ComplexityGuardOptions, ParseOptions}; use crate::parse_guard::constants::MAX_FUNCTION_CALL_DEPTH; -/// SQLQuack's default complexity limits, allowing SQLBuild's function-call depth. +/// SQLBabel's default complexity limits, allowing SQLBuild's function-call depth. #[must_use] -pub fn sqlquack_parse_options() -> ParseOptions { +pub fn sqlbabel_parse_options() -> ParseOptions { ParseOptions { complexity_guard: Some(ComplexityGuardOptions { max_function_call_depth: Some(MAX_FUNCTION_CALL_DEPTH), diff --git a/crates/sqlbuild-analysis/src/parse_guard/mod.rs b/crates/sqlbuild-analysis/src/parse_guard/mod.rs index 9a3d52ceff..71c6e24af5 100644 --- a/crates/sqlbuild-analysis/src/parse_guard/mod.rs +++ b/crates/sqlbuild-analysis/src/parse_guard/mod.rs @@ -1,4 +1,4 @@ -//! One call depth for Polyglot, SQLQuack's shared and Snowflake parsers and SQLClean's lint. +//! One call depth for Polyglot, SQLBabel's shared and Snowflake parsers and SQLClean's lint. pub mod constants; pub mod main; diff --git a/crates/sqlbuild-analysis/src/parse_guard/tests/helpers.rs b/crates/sqlbuild-analysis/src/parse_guard/tests/helpers.rs index 13be5c2772..e9ffeb2ddc 100644 --- a/crates/sqlbuild-analysis/src/parse_guard/tests/helpers.rs +++ b/crates/sqlbuild-analysis/src/parse_guard/tests/helpers.rs @@ -1,10 +1,10 @@ use polyglot_sql::DialectType; -use sqlquack_syntax::{CallMode, Dialect}; +use sqlbabel_syntax::{CallMode, Dialect}; use crate::analysis_route::models::SnowflakeDialect; use crate::analysis_route::types::NativeDialect; use crate::parse_guard::main::polyglot_parse_options::polyglot_parse_options; -use crate::parse_guard::main::sqlquack_parse_options::sqlquack_parse_options; +use crate::parse_guard::main::sqlbabel_parse_options::sqlbabel_parse_options; /// A query selecting `depth` nested `REPLACE` calls around one column. pub(super) fn nested_calls(depth: usize) -> String { @@ -40,11 +40,11 @@ pub(super) fn parses(sql: &str) -> Vec<(&'static str, Result<(), String>)> { .map_err(|gap| gap.message), ), ( - "SQLQuack Snowflake", - sqlquack_parse::parse_statements_with( + "SQLBabel Snowflake", + sqlbabel_parse::parse_statements_with( sql, Dialect::Snowflake, - &sqlquack_parse_options(), + &sqlbabel_parse_options(), CallMode::Faithful, ) .map(|_| ()) diff --git a/crates/sqlbuild-analysis/src/source_drift/_helpers/walk.rs b/crates/sqlbuild-analysis/src/source_drift/_helpers/walk.rs index fe45723dbc..e74298749a 100644 --- a/crates/sqlbuild-analysis/src/source_drift/_helpers/walk.rs +++ b/crates/sqlbuild-analysis/src/source_drift/_helpers/walk.rs @@ -2,9 +2,9 @@ use std::collections::HashSet; +use sqlbabel_syntax::expressions::queries::models::{Join, JoinKind, Select, With}; +use sqlbabel_syntax::{Expression, ExpressionWalk}; use sqlbuild_core::text::main::python_casefold::python_casefold; -use sqlquack_syntax::expressions::queries::models::{Join, JoinKind, Select, With}; -use sqlquack_syntax::{Expression, ExpressionWalk}; use crate::source_drift::constants::{COUNT_FUNCTION, OPAQUE_KINDS, SHARED_SCOPE_RELATIONS}; diff --git a/crates/sqlbuild-analysis/src/source_drift/main/reads_added_columns.rs b/crates/sqlbuild-analysis/src/source_drift/main/reads_added_columns.rs index 6fdbf7c388..5d2fe4bf98 100644 --- a/crates/sqlbuild-analysis/src/source_drift/main/reads_added_columns.rs +++ b/crates/sqlbuild-analysis/src/source_drift/main/reads_added_columns.rs @@ -2,8 +2,8 @@ use std::collections::HashSet; +use sqlbabel_syntax::Parsed; use sqlbuild_core::text::main::python_casefold::python_casefold; -use sqlquack_syntax::Parsed; use crate::analysis_route::main::analysis_route::analysis_route; use crate::analysis_route::models::AnalysisRoute; diff --git a/crates/sqlbuild-analysis/src/sql_macros/_helpers/parsing/body.rs b/crates/sqlbuild-analysis/src/sql_macros/_helpers/parsing/body.rs index 19a8c88587..77e61b6775 100644 --- a/crates/sqlbuild-analysis/src/sql_macros/_helpers/parsing/body.rs +++ b/crates/sqlbuild-analysis/src/sql_macros/_helpers/parsing/body.rs @@ -1,9 +1,9 @@ //! A SQL macro body parsed as SQL, its parameter references located and replaced in place. -use sqlquack_syntax::expressions::names::models::{Column, Identifier}; -use sqlquack_syntax::expressions::operators::models::DotAccess; -use sqlquack_syntax::expressions::queries::models::Select; -use sqlquack_syntax::{Expression, ExpressionWalk, Parsed}; +use sqlbabel_syntax::expressions::names::models::{Column, Identifier}; +use sqlbabel_syntax::expressions::operators::models::DotAccess; +use sqlbabel_syntax::expressions::queries::models::Select; +use sqlbabel_syntax::{Expression, ExpressionWalk, Parsed}; use crate::analysis_route::main::analysis_route::analysis_route; use crate::analysis_route::models::AnalysisRoute; diff --git a/crates/sqlbuild-analysis/src/sql_macros/_helpers/parsing/captures.rs b/crates/sqlbuild-analysis/src/sql_macros/_helpers/parsing/captures.rs index f02c20aa09..3f9279e560 100644 --- a/crates/sqlbuild-analysis/src/sql_macros/_helpers/parsing/captures.rs +++ b/crates/sqlbuild-analysis/src/sql_macros/_helpers/parsing/captures.rs @@ -1,7 +1,7 @@ //! Plain `COLUMNS` slot reads inside a subquery, and the subquery relations their bare names meet. -use sqlquack_syntax::expressions::queries::models::Select; -use sqlquack_syntax::{Expression, ExpressionWalk}; +use sqlbabel_syntax::expressions::queries::models::Select; +use sqlbabel_syntax::{Expression, ExpressionWalk}; use crate::analysis_route::types::NativeDialect; diff --git a/crates/sqlbuild-analysis/src/sql_macros/_helpers/rendering/cte_rename.rs b/crates/sqlbuild-analysis/src/sql_macros/_helpers/rendering/cte_rename.rs index 7c69b3d138..0c30564408 100644 --- a/crates/sqlbuild-analysis/src/sql_macros/_helpers/rendering/cte_rename.rs +++ b/crates/sqlbuild-analysis/src/sql_macros/_helpers/rendering/cte_rename.rs @@ -1,8 +1,8 @@ //! A CTE-list macro body's CTEs renamed for one call's `__cte` name, located by parsing. -use sqlquack_syntax::expressions::names::models::{Identifier, TableRef}; -use sqlquack_syntax::expressions::queries::models::With; -use sqlquack_syntax::{Expression, ExpressionWalk}; +use sqlbabel_syntax::expressions::names::models::{Identifier, TableRef}; +use sqlbabel_syntax::expressions::queries::models::With; +use sqlbabel_syntax::{Expression, ExpressionWalk}; use crate::analysis_route::types::NativeDialect; diff --git a/crates/sqlbuild-analysis/src/sql_macros/_helpers/typing/probes.rs b/crates/sqlbuild-analysis/src/sql_macros/_helpers/typing/probes.rs index dffc94d36b..7a1fdb6bf5 100644 --- a/crates/sqlbuild-analysis/src/sql_macros/_helpers/typing/probes.rs +++ b/crates/sqlbuild-analysis/src/sql_macros/_helpers/typing/probes.rs @@ -2,8 +2,8 @@ use std::collections::HashMap; -use sqlquack_semantics::lineage::models::{Nullability, SchemaColumn}; -use sqlquack_semantics::lineage::types::LineageSchema; +use sqlbabel_semantics::lineage::models::{Nullability, SchemaColumn}; +use sqlbabel_semantics::lineage::types::LineageSchema; use crate::analysis_route::main::analysis_route::analysis_route; use crate::analysis_route::models::{AnalysisInput, AnalysisRoute, NativeAnalysis}; diff --git a/crates/sqlbuild-analysis/src/sql_macros/_helpers/typing/typed_calls.rs b/crates/sqlbuild-analysis/src/sql_macros/_helpers/typing/typed_calls.rs index 01f77b06dc..58a0aff914 100644 --- a/crates/sqlbuild-analysis/src/sql_macros/_helpers/typing/typed_calls.rs +++ b/crates/sqlbuild-analysis/src/sql_macros/_helpers/typing/typed_calls.rs @@ -4,10 +4,10 @@ use std::borrow::Cow; use std::collections::HashMap; use std::sync::{LazyLock, Mutex, MutexGuard, PoisonError}; -use sqlquack_syntax::expressions::tree::constants::{ +use sqlbabel_syntax::expressions::tree::constants::{ TYPED_EXPRESSION_FUNCTION, TYPED_LIKE_EXPRESSION_FUNCTION, }; -use sqlquack_syntax::{Expression, ExpressionWalk, Parsed}; +use sqlbabel_syntax::{Expression, ExpressionWalk, Parsed}; use crate::analysis_route::main::analysis_route::analysis_route; use crate::analysis_route::models::AnalysisRoute; diff --git a/crates/sqlbuild-analysis/src/sql_macros/tests/test_typed_calls.rs b/crates/sqlbuild-analysis/src/sql_macros/tests/test_typed_calls.rs index 7ac928966d..ccc91f39de 100644 --- a/crates/sqlbuild-analysis/src/sql_macros/tests/test_typed_calls.rs +++ b/crates/sqlbuild-analysis/src/sql_macros/tests/test_typed_calls.rs @@ -1,4 +1,4 @@ -use sqlquack_semantics::lineage::types::LineageSchema; +use sqlbabel_semantics::lineage::types::LineageSchema; use crate::sql_macros::_helpers::typing::probes::ProbeSchema; use crate::sql_macros::main::typed_analysis_sql::typed_analysis_sql; @@ -223,7 +223,7 @@ fn given_the_reserved_analysis_function_when_comparing_then_authored_sql_rejects authored_name: sqlbuild_attachments::cursor_intrinsics::constants::RESERVED_ANALYSIS_FUNCTION, expected_parsed_name: - sqlquack_syntax::expressions::tree::constants::TYPED_EXPRESSION_FUNCTION, + sqlbabel_syntax::expressions::tree::constants::TYPED_EXPRESSION_FUNCTION, }]; for test_case in test_cases { diff --git a/crates/sqlbuild-analysis/src/sql_tokens/main/query_fingerprint.rs b/crates/sqlbuild-analysis/src/sql_tokens/main/query_fingerprint.rs index abe7cce0b3..bbb0f500c8 100644 --- a/crates/sqlbuild-analysis/src/sql_tokens/main/query_fingerprint.rs +++ b/crates/sqlbuild-analysis/src/sql_tokens/main/query_fingerprint.rs @@ -1,10 +1,10 @@ //! Whitespace-, comment- and keyword-case-insensitive SQL change fingerprints. -use sqlquack_fingerprint::FingerprintDialect; +use sqlbabel_fingerprint::FingerprintDialect; -/// SQLQuack's fingerprint of `sql` under `dialect_name`; dialects SQLQuack does not tokenize read generic tokens. +/// SQLBabel's fingerprint of `sql` under `dialect_name`; dialects SQLBabel does not tokenize read generic tokens. pub fn query_fingerprint(sql: &str, dialect_name: &str) -> Result { let dialect = FingerprintDialect::from_name(dialect_name).unwrap_or(FingerprintDialect::Generic); - sqlquack_fingerprint::query_fingerprint(sql, dialect).map_err(|error| error.to_string()) + sqlbabel_fingerprint::query_fingerprint(sql, dialect).map_err(|error| error.to_string()) } diff --git a/crates/sqlbuild-analysis/src/sql_tree/_helpers/clauses.rs b/crates/sqlbuild-analysis/src/sql_tree/_helpers/clauses.rs index 082d531fe1..6bf21ec544 100644 --- a/crates/sqlbuild-analysis/src/sql_tree/_helpers/clauses.rs +++ b/crates/sqlbuild-analysis/src/sql_tree/_helpers/clauses.rs @@ -1,11 +1,11 @@ -//! Clauses SQLQuack keeps as statement fields rather than expressions: CTEs, joins, a query's other clauses and a window's. +//! Clauses SQLBabel keeps as statement fields rather than expressions: CTEs, joins, a query's other clauses and a window's. -use sqlquack_syntax::Expression; -use sqlquack_syntax::expressions::names::models::Identifier; -use sqlquack_syntax::expressions::queries::models::{ +use sqlbabel_syntax::Expression; +use sqlbabel_syntax::expressions::names::models::Identifier; +use sqlbabel_syntax::expressions::queries::models::{ Cte, From, Join, JoinKind, OrderBy, Ordered, Over, Select, Where, With, }; -use sqlquack_syntax::tokens::models::Span; +use sqlbabel_syntax::tokens::models::Span; use crate::sql_tree::constants::{ CTE_KIND, FROM_KIND, GROUP_BY_KIND, HAVING_KIND, JOIN_KIND, LIMIT_KIND, ORDER_BY_KIND, diff --git a/crates/sqlbuild-analysis/src/sql_tree/_helpers/node_facts.rs b/crates/sqlbuild-analysis/src/sql_tree/_helpers/node_facts.rs index 4e768cc433..9c32970775 100644 --- a/crates/sqlbuild-analysis/src/sql_tree/_helpers/node_facts.rs +++ b/crates/sqlbuild-analysis/src/sql_tree/_helpers/node_facts.rs @@ -1,8 +1,8 @@ //! What a node names or holds: identifier, column, alias, table and CTE names, and literal values. -use sqlquack_syntax::Expression; -use sqlquack_syntax::expressions::names::models::{Identifier, Literal, TableRef}; -use sqlquack_syntax::tokens::models::Span; +use sqlbabel_syntax::Expression; +use sqlbabel_syntax::expressions::names::models::{Identifier, Literal, TableRef}; +use sqlbabel_syntax::tokens::models::Span; use crate::relation_markers::constants::MARKER_NAME_PREFIX; use crate::sql_tree::_helpers::source_map::SourceMap; diff --git a/crates/sqlbuild-analysis/src/sql_tree/_helpers/parse.rs b/crates/sqlbuild-analysis/src/sql_tree/_helpers/parse.rs index f9adb36c2e..543b83012a 100644 --- a/crates/sqlbuild-analysis/src/sql_tree/_helpers/parse.rs +++ b/crates/sqlbuild-analysis/src/sql_tree/_helpers/parse.rs @@ -1,8 +1,8 @@ //! Parse SQL into statements with node spans. -use sqlquack_syntax::{CallMode, Expression}; +use sqlbabel_syntax::{CallMode, Expression}; -use crate::parse_guard::main::sqlquack_parse_options::sqlquack_parse_options; +use crate::parse_guard::main::sqlbabel_parse_options::sqlbabel_parse_options; use crate::sql_tree::constants::GUARD_CODE_PREFIX; use crate::sql_tree::errors::SqlTreeError; use crate::sql_tree::models::TreeParser; @@ -10,15 +10,15 @@ use crate::sql_tree::models::TreeParser; /// The statements of `sql` under `parser`; a non-syntax PostgreSQL failure or a skipped statement is unanalysable. pub(crate) fn parse(sql: &str, parser: TreeParser) -> Result, SqlTreeError> { match parser { - TreeParser::Shared(dialect) => sqlquack_parse::parse_statements_with( + TreeParser::Shared(dialect) => sqlbabel_parse::parse_statements_with( sql, dialect, - &sqlquack_parse_options(), + &sqlbabel_parse_options(), CallMode::FaithfulLocated, ) .map_err(|error| shared_error(&error.to_string())), TreeParser::Postgres => { - let parsed = sqlquack_syntax_postgres::parse_strict(sql).map_err(|failure| { + let parsed = sqlbabel_syntax_postgres::parse_strict(sql).map_err(|failure| { match failure.parse_error() { Some(error) if error.syntax => SqlTreeError::Parse(error.message.clone()), Some(error) => SqlTreeError::Unanalysable(error.message.clone()), diff --git a/crates/sqlbuild-analysis/src/sql_tree/_helpers/source_map.rs b/crates/sqlbuild-analysis/src/sql_tree/_helpers/source_map.rs index 171852bbcd..80d7b129a6 100644 --- a/crates/sqlbuild-analysis/src/sql_tree/_helpers/source_map.rs +++ b/crates/sqlbuild-analysis/src/sql_tree/_helpers/source_map.rs @@ -2,7 +2,7 @@ use std::ops::Range; -use sqlquack_syntax::tokens::models::Span; +use sqlbabel_syntax::tokens::models::Span; use crate::relation_markers::types::MarkerRanges; use crate::sql_tree::_helpers::positions::{line_column, line_starts}; diff --git a/crates/sqlbuild-analysis/src/sql_tree/_helpers/walk.rs b/crates/sqlbuild-analysis/src/sql_tree/_helpers/walk.rs index d7e214bccd..23a4382314 100644 --- a/crates/sqlbuild-analysis/src/sql_tree/_helpers/walk.rs +++ b/crates/sqlbuild-analysis/src/sql_tree/_helpers/walk.rs @@ -2,8 +2,8 @@ use std::collections::HashMap; -use sqlquack_syntax::tokens::models::Span; -use sqlquack_syntax::{Expression, ExpressionWalk}; +use sqlbabel_syntax::tokens::models::Span; +use sqlbabel_syntax::{Expression, ExpressionWalk}; use crate::sql_tree::_helpers::clauses::clauses; use crate::sql_tree::_helpers::node_facts::{named, node_literal, node_name, table_span}; diff --git a/crates/sqlbuild-analysis/src/sql_tree/constants.rs b/crates/sqlbuild-analysis/src/sql_tree/constants.rs index 7f9de74d81..a11d08df22 100644 --- a/crates/sqlbuild-analysis/src/sql_tree/constants.rs +++ b/crates/sqlbuild-analysis/src/sql_tree/constants.rs @@ -1,8 +1,8 @@ -//! Node kinds the rule tree adds to SQLQuack's expression variants, and kinds it refuses. +//! Node kinds the rule tree adds to SQLBabel's expression variants, and kinds it refuses. -/// The kind of a join clause, which SQLQuack keeps as a field of its statement. +/// The kind of a join clause, which SQLBabel keeps as a field of its statement. pub(crate) const JOIN_KIND: &str = "join"; -/// The kind of a common table expression, which SQLQuack keeps as a field of its statement. +/// The kind of a common table expression, which SQLBabel keeps as a field of its statement. pub(crate) const CTE_KIND: &str = "cte"; /// The kind owning a query's select list. pub(crate) const PROJECTION_KIND: &str = "projection"; diff --git a/crates/sqlbuild-analysis/src/sql_tree/errors.rs b/crates/sqlbuild-analysis/src/sql_tree/errors.rs index 20f686eb92..d1dc201a77 100644 --- a/crates/sqlbuild-analysis/src/sql_tree/errors.rs +++ b/crates/sqlbuild-analysis/src/sql_tree/errors.rs @@ -2,10 +2,10 @@ use std::fmt::{self, Display}; -/// A dialect SQLQuack does not parse, SQL it rejects, or SQL it read only as opaque text. +/// A dialect SQLBabel does not parse, SQL it rejects, or SQL it read only as opaque text. #[derive(Clone, Debug, PartialEq, Eq)] pub enum SqlTreeError { - /// No SQLQuack parser reads this dialect yet. + /// No SQLBabel parser reads this dialect yet. UnavailableDialect(String), /// The parser read the SQL but kept part of it as unparsed text or refused its depth. Unanalysable(String), @@ -20,7 +20,7 @@ impl Display for SqlTreeError { match self { Self::UnavailableDialect(dialect) => write!( formatter, - "SQL syntax trees are unavailable for the {dialect} dialect: SQLQuack does not parse it yet" + "SQL syntax trees are unavailable for the {dialect} dialect: SQLBabel does not parse it yet" ), Self::Unanalysable(reason) => { write!(formatter, "SQL syntax tree is unavailable: {reason}") diff --git a/crates/sqlbuild-analysis/src/sql_tree/main/deeper_than.rs b/crates/sqlbuild-analysis/src/sql_tree/main/deeper_than.rs index 30d6a9998d..079257515d 100644 --- a/crates/sqlbuild-analysis/src/sql_tree/main/deeper_than.rs +++ b/crates/sqlbuild-analysis/src/sql_tree/main/deeper_than.rs @@ -1,6 +1,6 @@ //! `deeper_than`: whether a parsed statement nests past a depth limit. -use sqlquack_syntax::{Expression, ExpressionWalk}; +use sqlbabel_syntax::{Expression, ExpressionWalk}; /// Whether `statement` nests more than `limit` levels, walked iteratively so depth cannot overflow. pub fn deeper_than(statement: &Expression, limit: usize) -> bool { diff --git a/crates/sqlbuild-analysis/src/sql_tree/main/shared_dialect.rs b/crates/sqlbuild-analysis/src/sql_tree/main/shared_dialect.rs index 5a7e95518e..0c900cc0e1 100644 --- a/crates/sqlbuild-analysis/src/sql_tree/main/shared_dialect.rs +++ b/crates/sqlbuild-analysis/src/sql_tree/main/shared_dialect.rs @@ -1,6 +1,6 @@ -//! `shared_dialect`: the grammar of SQLQuack's shared parser that reads a dialect's SQL. +//! `shared_dialect`: the grammar of SQLBabel's shared parser that reads a dialect's SQL. -use sqlquack_syntax::Dialect; +use sqlbabel_syntax::Dialect; use crate::sql_tree::constants::{ DUCKDB_DIALECTS, POSTGRES_DIALECTS, SNOWFLAKE_DIALECT, SQLITE_DIALECT, diff --git a/crates/sqlbuild-analysis/src/sql_tree/main/sql_tree_nodes.rs b/crates/sqlbuild-analysis/src/sql_tree/main/sql_tree_nodes.rs index f94624e1f2..ebe2dca274 100644 --- a/crates/sqlbuild-analysis/src/sql_tree/main/sql_tree_nodes.rs +++ b/crates/sqlbuild-analysis/src/sql_tree/main/sql_tree_nodes.rs @@ -1,7 +1,7 @@ //! `sql_tree_nodes`: a rule's SQL syntax tree as nodes in pre-order. +use sqlbabel_syntax::Expression; use sqlbuild_sqltext::sql_scan::main::dialect_lexical_syntax::dialect_lexical_syntax; -use sqlquack_syntax::Expression; use crate::sql_tree::_helpers::parse::parse; use crate::sql_tree::_helpers::rules_tree_parser::rules_tree_parser; diff --git a/crates/sqlbuild-analysis/src/sql_tree/mod.rs b/crates/sqlbuild-analysis/src/sql_tree/mod.rs index 264e63cb56..df5ba7e9f0 100644 --- a/crates/sqlbuild-analysis/src/sql_tree/mod.rs +++ b/crates/sqlbuild-analysis/src/sql_tree/mod.rs @@ -1,4 +1,4 @@ -//! SQL syntax trees for custom rules, parsed by the SQLQuack parser of each dialect. +//! SQL syntax trees for custom rules, parsed by the SQLBabel parser of each dialect. pub(crate) mod _helpers; mod constants; diff --git a/crates/sqlbuild-analysis/src/sql_tree/models.rs b/crates/sqlbuild-analysis/src/sql_tree/models.rs index 1e4b2f8811..9c324f8bc4 100644 --- a/crates/sqlbuild-analysis/src/sql_tree/models.rs +++ b/crates/sqlbuild-analysis/src/sql_tree/models.rs @@ -1,9 +1,9 @@ //! Nodes of a rule's SQL syntax tree. -/// One node: its SQLQuack kind, where it starts and ends, what it names or holds, and its parent's index in pre-order. +/// One node: its SQLBabel kind, where it starts and ends, what it names or holds, and its parent's index in pre-order. #[derive(Clone, Debug, PartialEq, Eq)] pub struct SqlTreeNode { - /// SQLQuack's snake_case node kind, such as `select`, `subquery`, `star`, `join` or `cte`. + /// SQLBabel's snake_case node kind, such as `select`, `subquery`, `star`, `join` or `cte`. pub kind: &'static str, /// 1-based line of the node's first character; a node without a span takes its parent's. pub line: usize, @@ -41,7 +41,7 @@ pub struct NodeName { pub qualifier: Vec, } -/// A literal's value as written, without quotes, and its SQLQuack type, such as `string` or `number`. +/// A literal's value as written, without quotes, and its SQLBabel type, such as `string` or `number`. #[derive(Clone, Debug, PartialEq, Eq)] pub struct NodeLiteral { /// The value's text. @@ -50,11 +50,11 @@ pub struct NodeLiteral { pub literal_type: &'static str, } -/// The SQLQuack parser that reads a dialect's SQL for rules. +/// The SQLBabel parser that reads a dialect's SQL for rules. #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub(crate) enum TreeParser { - /// `sqlquack_syntax_postgres`'s native PostgreSQL parser. + /// `sqlbabel_syntax_postgres`'s native PostgreSQL parser. Postgres, - /// `sqlquack_syntax`'s shared parser for one dialect, recording node spans. - Shared(sqlquack_syntax::Dialect), + /// `sqlbabel_syntax`'s shared parser for one dialect, recording node spans. + Shared(sqlbabel_syntax::Dialect), } diff --git a/crates/sqlbuild-analysis/src/sql_tree/tests/helpers.rs b/crates/sqlbuild-analysis/src/sql_tree/tests/helpers.rs index 61a5815f1f..1bd96df1c4 100644 --- a/crates/sqlbuild-analysis/src/sql_tree/tests/helpers.rs +++ b/crates/sqlbuild-analysis/src/sql_tree/tests/helpers.rs @@ -17,7 +17,7 @@ const CLAUSE_KINDS: [&str; 10] = [ /// How a name's fact reads unquoted, then quoted. const QUOTING: [&str; 2] = ["", " quoted"]; -/// The listed kinds' nodes with their parent's kind, sorted by position, since child order is SQLQuack's. +/// The listed kinds' nodes with their parent's kind, sorted by position, since child order is SQLBabel's. pub(crate) fn shape( nodes: &[SqlTreeNode], ) -> Vec<(&'static str, usize, usize, Option<&'static str>)> { diff --git a/crates/sqlbuild-analysis/src/sql_tree/tests/test_sql_tree.rs b/crates/sqlbuild-analysis/src/sql_tree/tests/test_sql_tree.rs index d63486640c..8496d40297 100644 --- a/crates/sqlbuild-analysis/src/sql_tree/tests/test_sql_tree.rs +++ b/crates/sqlbuild-analysis/src/sql_tree/tests/test_sql_tree.rs @@ -269,7 +269,7 @@ fn given_sql_when_building_a_rule_tree_then_nodes_carry_names_literals_and_sourc fn given_sql_without_a_full_tree_when_building_a_rule_tree_then_the_reason_is_reported() { let test_cases = [ TreeFailureTestCase { - description: "a dialect SQLQuack does not parse", + description: "a dialect SQLBabel does not parse", dialect: "bigquery", sql: "SELECT 1".to_owned(), expected_error: |error| matches!(error, SqlTreeError::UnavailableDialect(name) if name == "bigquery"), diff --git a/crates/sqlbuild-analysis/src/type_system/_helpers/parsed.rs b/crates/sqlbuild-analysis/src/type_system/_helpers/parsed.rs index 3d2cada562..158817eada 100644 --- a/crates/sqlbuild-analysis/src/type_system/_helpers/parsed.rs +++ b/crates/sqlbuild-analysis/src/type_system/_helpers/parsed.rs @@ -1,7 +1,7 @@ //! A parsed type's normalization: its tag, parameters and dialect spelling. use serde_json::Value; -use sqlquack_syntax::tokens::models::Dialect; +use sqlbabel_syntax::tokens::models::Dialect; use crate::type_system::_helpers::fallback::{ normalize_with_fallback, python_or_default, simple, snowflake_integer, @@ -22,7 +22,7 @@ use crate::type_system::models::{NormalizedType, PythonInteger, TypeDialect, Typ use crate::warehouse_types::main::type_tree::type_tree; use crate::warehouse_types::models::TypeParser; -/// The type tree of `type_sql` from SQLQuack's parser, else SQLBuild's reader, or the error. +/// The type tree of `type_sql` from SQLBabel's parser, else SQLBuild's reader, or the error. pub(crate) fn parse_type(type_sql: &str, dialect: SpellingDialect) -> Result { if nesting_bound(type_sql) > MAX_TYPE_NESTING { return Err("the type nests too deeply".to_owned()); diff --git a/crates/sqlbuild-analysis/src/type_system/_helpers/type_reader.rs b/crates/sqlbuild-analysis/src/type_system/_helpers/type_reader.rs index 4ee2951ea5..c746203fa6 100644 --- a/crates/sqlbuild-analysis/src/type_system/_helpers/type_reader.rs +++ b/crates/sqlbuild-analysis/src/type_system/_helpers/type_reader.rs @@ -1,4 +1,4 @@ -//! SQLBuild's own type reader, which builds the tree SQLQuack's type parsers build. +//! SQLBuild's own type reader, which builds the tree SQLBabel's type parsers build. use serde_json::{Map, Value, json}; diff --git a/crates/sqlbuild-analysis/src/type_system/constants.rs b/crates/sqlbuild-analysis/src/type_system/constants.rs index 8fd1b089fb..39f6143654 100644 --- a/crates/sqlbuild-analysis/src/type_system/constants.rs +++ b/crates/sqlbuild-analysis/src/type_system/constants.rs @@ -9,7 +9,7 @@ pub(crate) const FLOAT_TYPE_NAMES: &[&str] = &["DOUBLE", "FLOAT", "FLOAT64", "RE pub(crate) const INTEGER_TYPE_NAMES: &[&str] = &[ "BIGINT", "INT", "INT64", "INTEGER", "LONG", "SMALLINT", "TINYINT", ]; -/// The deepest type nesting SQLBuild reads: SQLQuack's syntax tree depth. +/// The deepest type nesting SQLBuild reads: SQLBabel's syntax tree depth. pub(crate) const MAX_TYPE_NESTING: usize = 512; /// The type nesting read on the caller's stack; deeper types get their own. pub(crate) const SHALLOW_TYPE_NESTING: usize = 32; diff --git a/crates/sqlbuild-analysis/src/warehouse_types/_helpers/type_trees.rs b/crates/sqlbuild-analysis/src/warehouse_types/_helpers/type_trees.rs index e489646a9f..8e42bb25e8 100644 --- a/crates/sqlbuild-analysis/src/warehouse_types/_helpers/type_trees.rs +++ b/crates/sqlbuild-analysis/src/warehouse_types/_helpers/type_trees.rs @@ -1,32 +1,32 @@ -//! Type trees from SQLQuack's parsers: Postgres's type grammar, or a cast target's type. +//! Type trees from SQLBabel's parsers: Postgres's type grammar, or a cast target's type. use serde_json::Value; -use sqlquack_parse::parse_strict; -use sqlquack_syntax::Expression; -use sqlquack_syntax::expressions::types::models::DataType; -use sqlquack_syntax::tokens::models::Dialect; +use sqlbabel_parse::parse_strict; +use sqlbabel_syntax::Expression; +use sqlbabel_syntax::expressions::types::models::DataType; +use sqlbabel_syntax::tokens::models::Dialect; -use crate::parse_guard::main::sqlquack_parse_options::sqlquack_parse_options; +use crate::parse_guard::main::sqlbabel_parse_options::sqlbabel_parse_options; use crate::warehouse_types::constants::{CAST_KEY, CAST_TARGET_KEY, DATA_TYPE_KEY, NAMED_TYPE_TAG}; -/// `spelling` read by `sqlquack-syntax-postgres`'s type grammar. +/// `spelling` read by `sqlbabel-syntax-postgres`'s type grammar. pub(crate) fn postgres_type(spelling: &str) -> Result { let data_type = - sqlquack_syntax_postgres::parse_type(spelling).map_err(|error| format!("{error:?}"))?; + sqlbabel_syntax_postgres::parse_type(spelling).map_err(|error| format!("{error:?}"))?; serde_json::to_value(data_type).map_err(|error| error.to_string()) } -/// `spelling` read as a cast target by SQLQuack's core parser for `dialect`. +/// `spelling` read as a cast target by SQLBabel's core parser for `dialect`. pub(crate) fn core_type(spelling: &str, dialect: Dialect) -> Result { let statements: Vec = - parse_strict(&cast(spelling), dialect, &sqlquack_parse_options()) + parse_strict(&cast(spelling), dialect, &sqlbabel_parse_options()) .map_err(|error| format!("{error:?}"))?; single_cast_target(spelling, &statements) } -/// `spelling` read as a cast target by `sqlquack-syntax-bigquery`. +/// `spelling` read as a cast target by `sqlbabel-syntax-bigquery`. pub(crate) fn bigquery_type(spelling: &str) -> Result { - let statements: Vec = sqlquack_syntax_bigquery::parse_strict(&cast(spelling)) + let statements: Vec = sqlbabel_syntax_bigquery::parse_strict(&cast(spelling)) .map_err(|error| format!("{error:?}"))? .statements; single_cast_target(spelling, &statements) diff --git a/crates/sqlbuild-analysis/src/warehouse_types/constants.rs b/crates/sqlbuild-analysis/src/warehouse_types/constants.rs index d64f706fbd..cb78d77c3f 100644 --- a/crates/sqlbuild-analysis/src/warehouse_types/constants.rs +++ b/crates/sqlbuild-analysis/src/warehouse_types/constants.rs @@ -12,5 +12,5 @@ pub(crate) const SNOWFLAKE_DIALECT: &str = "snowflake"; pub(crate) const BIGQUERY_DIALECT: &str = "bigquery"; /// The tree key naming a type's kind. pub(crate) const DATA_TYPE_KEY: &str = "data_type"; -/// The kind of a type SQLQuack keeps as written with its parameters in fields, such as Snowflake's `NUMBER(10, 2)`. +/// The kind of a type SQLBabel keeps as written with its parameters in fields, such as Snowflake's `NUMBER(10, 2)`. pub(crate) const NAMED_TYPE_TAG: &str = "named"; diff --git a/crates/sqlbuild-analysis/src/warehouse_types/main/parse_warehouse_type.rs b/crates/sqlbuild-analysis/src/warehouse_types/main/parse_warehouse_type.rs index 4128082fb4..69d246d7ae 100644 --- a/crates/sqlbuild-analysis/src/warehouse_types/main/parse_warehouse_type.rs +++ b/crates/sqlbuild-analysis/src/warehouse_types/main/parse_warehouse_type.rs @@ -1,7 +1,7 @@ -//! `parse_warehouse_type`: a warehouse type name as SQLQuack's parser for its dialect reads it. +//! `parse_warehouse_type`: a warehouse type name as SQLBabel's parser for its dialect reads it. use serde_json::Value; -use sqlquack_syntax::tokens::models::Dialect; +use sqlbabel_syntax::tokens::models::Dialect; use crate::warehouse_types::constants::{BIGQUERY_DIALECT, POSTGRES_DIALECT, SNOWFLAKE_DIALECT}; use crate::warehouse_types::main::type_tree::type_tree; diff --git a/crates/sqlbuild-analysis/src/warehouse_types/main/type_tree.rs b/crates/sqlbuild-analysis/src/warehouse_types/main/type_tree.rs index cfa9c12309..c505443c3d 100644 --- a/crates/sqlbuild-analysis/src/warehouse_types/main/type_tree.rs +++ b/crates/sqlbuild-analysis/src/warehouse_types/main/type_tree.rs @@ -1,4 +1,4 @@ -//! `type_tree`: a type name as one of SQLQuack's parsers reads it. +//! `type_tree`: a type name as one of SQLBabel's parsers reads it. use serde_json::Value; diff --git a/crates/sqlbuild-analysis/src/warehouse_types/mod.rs b/crates/sqlbuild-analysis/src/warehouse_types/mod.rs index 8e1b42f6e3..f0b3e99416 100644 --- a/crates/sqlbuild-analysis/src/warehouse_types/mod.rs +++ b/crates/sqlbuild-analysis/src/warehouse_types/mod.rs @@ -1,4 +1,4 @@ -//! Warehouse column type names as SQLQuack's parser for each warehouse dialect reads them. +//! Warehouse column type names as SQLBabel's parser for each warehouse dialect reads them. pub(crate) mod _helpers; pub(crate) mod constants; diff --git a/crates/sqlbuild-analysis/src/warehouse_types/models.rs b/crates/sqlbuild-analysis/src/warehouse_types/models.rs index 8fb7d377e6..2d49bf2182 100644 --- a/crates/sqlbuild-analysis/src/warehouse_types/models.rs +++ b/crates/sqlbuild-analysis/src/warehouse_types/models.rs @@ -1,14 +1,14 @@ -//! The SQLQuack parsers that read warehouse type names. +//! The SQLBabel parsers that read warehouse type names. -use sqlquack_syntax::tokens::models::Dialect; +use sqlbabel_syntax::tokens::models::Dialect; -/// Which SQLQuack parser reads a type name. +/// Which SQLBabel parser reads a type name. #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum TypeParser { - /// `sqlquack-syntax-postgres`'s type grammar. + /// `sqlbabel-syntax-postgres`'s type grammar. Postgres, - /// A cast target read by `sqlquack-syntax-bigquery`. + /// A cast target read by `sqlbabel-syntax-bigquery`. BigQuery, - /// A cast target read by SQLQuack's core parser for the dialect. + /// A cast target read by SQLBabel's core parser for the dialect. Core(Dialect), } diff --git a/crates/sqlbuild-orchestration/Cargo.toml b/crates/sqlbuild-orchestration/Cargo.toml index 598b7ef49f..1963a3a29c 100644 --- a/crates/sqlbuild-orchestration/Cargo.toml +++ b/crates/sqlbuild-orchestration/Cargo.toml @@ -33,7 +33,7 @@ sqlbuild-cursor.workspace = true sqlbuild-model-config.workspace = true sqlbuild-recall.workspace = true sqlbuild-state.workspace = true -sqlquack-fingerprint.workspace = true +sqlbabel-fingerprint.workspace = true sqlx-core.workspace = true sqlx-postgres.workspace = true subtle.workspace = true diff --git a/crates/sqlbuild-orchestration/src/warehouse_metadata/_helpers/node_status.rs b/crates/sqlbuild-orchestration/src/warehouse_metadata/_helpers/node_status.rs index 008345ff11..68de479656 100644 --- a/crates/sqlbuild-orchestration/src/warehouse_metadata/_helpers/node_status.rs +++ b/crates/sqlbuild-orchestration/src/warehouse_metadata/_helpers/node_status.rs @@ -2,9 +2,9 @@ use std::collections::{BTreeSet, HashMap}; +use sqlbabel_fingerprint::{FingerprintDialect, FingerprintError}; use sqlbuild_core::fingerprint_identity::main::fingerprint_dialect::fingerprint_dialect; use sqlbuild_core::fingerprint_identity::main::recorded_model_local_hash::recorded_model_local_hash; -use sqlquack_fingerprint::{FingerprintDialect, FingerprintError}; use uuid::Uuid; use crate::snapshots::constants::MODEL_NODE_KIND; @@ -90,7 +90,7 @@ fn rehash_text<'a>(node: &SnapshotNode, build: Option<&'a RecordedBuild>) -> Opt fn query_hash(sql: &str, dialect: Option<&str>, recorded: &str) -> String { let dialect = FingerprintDialect::from_name(fingerprint_dialect(dialect)) .unwrap_or(FingerprintDialect::Generic); - sqlquack_fingerprint::query_fingerprint(sql, dialect) + sqlbabel_fingerprint::query_fingerprint(sql, dialect) .unwrap_or_else(|_: FingerprintError| recorded.to_owned()) } diff --git a/crates/sqlbuild-orchestration/tests/api/node_status/helpers.rs b/crates/sqlbuild-orchestration/tests/api/node_status/helpers.rs index 1cfc9d2ca7..72443e2d13 100644 --- a/crates/sqlbuild-orchestration/tests/api/node_status/helpers.rs +++ b/crates/sqlbuild-orchestration/tests/api/node_status/helpers.rs @@ -671,9 +671,9 @@ async fn fingerprint_scheme_change_reads( let text = |key: &str| data[key].as_str().expect(key).to_owned(); let metadata: String = data["metadata"].to_string(); let current_hash: String = recorded_model_local_hash( - &sqlquack_fingerprint::query_fingerprint( + &sqlbabel_fingerprint::query_fingerprint( &text("definition"), - sqlquack_fingerprint::FingerprintDialect::DuckDB, + sqlbabel_fingerprint::FingerprintDialect::DuckDB, ) .expect("current fingerprint"), &metadata, diff --git a/crates/sqlbuild-python-compile/src/rules/_helpers/sql/sql_document.rs b/crates/sqlbuild-python-compile/src/rules/_helpers/sql/sql_document.rs index b932d866fa..f12a2d863f 100644 --- a/crates/sqlbuild-python-compile/src/rules/_helpers/sql/sql_document.rs +++ b/crates/sqlbuild-python-compile/src/rules/_helpers/sql/sql_document.rs @@ -1,4 +1,4 @@ -//! Custom rules' SQL documents: the SQLQuack syntax tree of one SQL text and its common structures. +//! Custom rules' SQL documents: the SQLBabel syntax tree of one SQL text and its common structures. use std::collections::HashMap; use std::sync::Arc; @@ -122,7 +122,7 @@ impl SqlTreeNode { self.extent().map(|extent| extent.span) } - /// The node's direct children, in SQLQuack's traversal order. + /// The node's direct children, in SQLBabel's traversal order. #[getter] fn children<'py>(&self, py: Python<'py>) -> PyResult> { let children: PyResult>> = self.tree.children[self.index] @@ -172,7 +172,7 @@ impl SqlTreeNode { } } -/// One SQL text a custom rule reads, parsed on first use by its dialect's SQLQuack parser. +/// One SQL text a custom rule reads, parsed on first use by its dialect's SQLBabel parser. #[pyclass(module = "sqlbuild._native", frozen)] pub(crate) struct SqlDocument { #[pyo3(get)] diff --git a/crates/sqlbuild-rules/Cargo.toml b/crates/sqlbuild-rules/Cargo.toml index cd31ad35c2..c95f28d1e8 100644 --- a/crates/sqlbuild-rules/Cargo.toml +++ b/crates/sqlbuild-rules/Cargo.toml @@ -13,9 +13,9 @@ fensu-facts.workspace = true fensu-native.workspace = true fensu-policy.workspace = true globset.workspace = true -sqlquack-parse.workspace = true -sqlquack-syntax.workspace = true -sqlquack-tokenize.workspace = true +sqlbabel-parse.workspace = true +sqlbabel-syntax.workspace = true +sqlbabel-tokenize.workspace = true rayon.workspace = true regex.workspace = true rustc-hash.workspace = true diff --git a/crates/sqlbuild-rules/src/lint_text/tests/test_lint_text.rs b/crates/sqlbuild-rules/src/lint_text/tests/test_lint_text.rs index 9f89d14f25..ad7a33af78 100644 --- a/crates/sqlbuild-rules/src/lint_text/tests/test_lint_text.rs +++ b/crates/sqlbuild-rules/src/lint_text/tests/test_lint_text.rs @@ -936,7 +936,7 @@ fn given_snowflake_table_function_calls_when_formatting_then_each_call_is_kept_w #[test] fn given_engine_response_when_dialect_is_unavailable_then_each_file_gets_one_warning() { const REASON: &str = - "SQL lint is unavailable for the tsql dialect: SQLQuack does not parse it yet"; + "SQL lint is unavailable for the tsql dialect: SQLBabel does not parse it yet"; let test_cases = [ UnavailableLintTestCase { description: "an unavailable reason warns once at the file's first body", diff --git a/crates/sqlbuild-rules/src/query_facts/_helpers/facts.rs b/crates/sqlbuild-rules/src/query_facts/_helpers/facts.rs index 7c97427f49..d1bc9c76c2 100644 --- a/crates/sqlbuild-rules/src/query_facts/_helpers/facts.rs +++ b/crates/sqlbuild-rules/src/query_facts/_helpers/facts.rs @@ -8,12 +8,12 @@ use crate::query_facts::models::{ CallKind, ColumnFact, ComparisonFacts, ComparisonSpan, CteFacts, ExpressionItem, ItemFacts, ModelShape, ParsedFixture, QueryFacts, RelationFacts, SelectFacts, SetFacts, SourceText, }; -use sqlbuild_analysis::parse_guard::main::sqlquack_parse_options::sqlquack_parse_options; +use sqlbabel_syntax::expressions::names::models::{Identifier, Literal, TableRef}; +use sqlbabel_syntax::expressions::queries::models::{Select, With}; +use sqlbabel_syntax::{CallMode, Dialect, Expression, ExpressionWalk}; +use sqlbuild_analysis::parse_guard::main::sqlbabel_parse_options::sqlbabel_parse_options; use sqlbuild_analysis::sql_tree::main::deeper_than::deeper_than; use sqlbuild_analysis::sql_tree::main::shared_dialect::shared_dialect; -use sqlquack_syntax::expressions::names::models::{Identifier, Literal, TableRef}; -use sqlquack_syntax::expressions::queries::models::{Select, With}; -use sqlquack_syntax::{CallMode, Dialect, Expression, ExpressionWalk}; use std::cell::{Cell, RefCell}; use std::collections::{HashMap, HashSet}; use std::ops::Range; @@ -21,9 +21,9 @@ use std::ops::Range; fn parse_query(sql: &str, dialect_name: &str) -> Result<(Expression, Dialect), String> { let dialect = shared_dialect(dialect_name) .ok_or_else(|| format!("no SQL parser for dialect {dialect_name}"))?; - let options = sqlquack_parse_options(); + let options = sqlbabel_parse_options(); let mut statements = - sqlquack_parse::parse_statements_with(sql, dialect, &options, CallMode::FaithfulLocated) + sqlbabel_parse::parse_statements_with(sql, dialect, &options, CallMode::FaithfulLocated) .map_err(|error| error.to_string())?; if statements.len() != 1 { return Err("expected one statement".to_owned()); @@ -42,7 +42,7 @@ fn parse_query(sql: &str, dialect_name: &str) -> Result<(Expression, Dialect), S } fn code_tokens(sql: &str, dialect: Dialect) -> Result, String> { - let tokens = sqlquack_parse::tokenize(sql, dialect).map_err(|error| error.to_string())?; + let tokens = sqlbabel_parse::tokenize(sql, dialect).map_err(|error| error.to_string())?; Ok(QueryTokens::new(tokens, sql)) } @@ -77,7 +77,7 @@ pub(crate) fn parse_fixture( }) } -/// Parse normalized model SQL with SQLQuack and read the facts built-in rules evaluate. +/// Parse normalized model SQL with SQLBabel and read the facts built-in rules evaluate. pub(crate) fn query_facts(sql: &str, dialect_name: &str) -> Result { let (statement, dialect) = parse_query(sql, dialect_name)?; let tokens = code_tokens(sql, dialect)?; diff --git a/crates/sqlbuild-rules/src/query_facts/_helpers/flatten.rs b/crates/sqlbuild-rules/src/query_facts/_helpers/flatten.rs index bffbe5157d..8b15eb712d 100644 --- a/crates/sqlbuild-rules/src/query_facts/_helpers/flatten.rs +++ b/crates/sqlbuild-rules/src/query_facts/_helpers/flatten.rs @@ -1,8 +1,8 @@ //! FLATTEN facts: the element each FLATTEN reads, and the whole elements a select item copies. -use sqlquack_syntax::Expression; -use sqlquack_syntax::expressions::functions::models::Function; -use sqlquack_syntax::expressions::names::models::Literal; +use sqlbabel_syntax::Expression; +use sqlbabel_syntax::expressions::functions::models::Function; +use sqlbabel_syntax::expressions::names::models::Literal; use crate::query_facts::models::{FlattenInput, WholeValue}; diff --git a/crates/sqlbuild-rules/src/query_facts/_helpers/tokens.rs b/crates/sqlbuild-rules/src/query_facts/_helpers/tokens.rs index 4d5970efc0..09b7d7e0b2 100644 --- a/crates/sqlbuild-rules/src/query_facts/_helpers/tokens.rs +++ b/crates/sqlbuild-rules/src/query_facts/_helpers/tokens.rs @@ -1,8 +1,8 @@ use crate::query_facts::constants::MIN_CAST_TOKENS; use crate::query_facts::models::{CodeToken, ComparisonSpan}; -use sqlquack_syntax::tokens::models::TokenType; -use sqlquack_tokenize::LosslessToken; -use sqlquack_tokenize::TokenKind; +use sqlbabel_syntax::tokens::models::TokenType; +use sqlbabel_tokenize::LosslessToken; +use sqlbabel_tokenize::TokenKind; use std::cell::RefCell; use std::collections::HashSet; use std::ops::Range; diff --git a/crates/sqlbuild-rules/src/query_facts/main/query_facts.rs b/crates/sqlbuild-rules/src/query_facts/main/query_facts.rs index e246caab16..78644ff312 100644 --- a/crates/sqlbuild-rules/src/query_facts/main/query_facts.rs +++ b/crates/sqlbuild-rules/src/query_facts/main/query_facts.rs @@ -1,6 +1,6 @@ use crate::query_facts::models::QueryFacts; -/// Parse normalized model SQL with SQLQuack and read the facts built-in rules evaluate. +/// Parse normalized model SQL with SQLBabel and read the facts built-in rules evaluate. pub(crate) fn query_facts(sql: &str, dialect: &str) -> Result { crate::query_facts::_helpers::facts::query_facts(sql, dialect) } diff --git a/crates/sqlbuild-rules/src/query_facts/models.rs b/crates/sqlbuild-rules/src/query_facts/models.rs index bd64b65dd8..3db227cfa1 100644 --- a/crates/sqlbuild-rules/src/query_facts/models.rs +++ b/crates/sqlbuild-rules/src/query_facts/models.rs @@ -1,5 +1,5 @@ -use sqlquack_syntax::Expression; -use sqlquack_syntax::tokens::models::TokenType; +use sqlbabel_syntax::Expression; +use sqlbabel_syntax::tokens::models::TokenType; use std::collections::BTreeSet; use crate::lint_text::main::map_expanded_offset::map_expanded_offset; @@ -215,7 +215,7 @@ impl QueryFacts { } } -/// An SQL-test fixture query parsed with SQLQuack, with the function-call facts its rules read. +/// An SQL-test fixture query parsed with SQLBabel, with the function-call facts its rules read. #[derive(Debug)] pub(crate) struct ParsedFixture { pub(crate) statement: Expression, diff --git a/crates/sqlbuild-rules/src/rules/_helpers/sql_checks/sql_test_rules.rs b/crates/sqlbuild-rules/src/rules/_helpers/sql_checks/sql_test_rules.rs index 3ad64cc655..92803091e8 100644 --- a/crates/sqlbuild-rules/src/rules/_helpers/sql_checks/sql_test_rules.rs +++ b/crates/sqlbuild-rules/src/rules/_helpers/sql_checks/sql_test_rules.rs @@ -11,10 +11,10 @@ use crate::query_facts::models::{CallKind, ParsedFixture}; use crate::rules::_helpers::dispatch::evaluation::{path_fault, rules_unavailable}; use crate::rules::models::ProjectEvaluationRequest; use serde::{Deserialize, Serialize}; +use sqlbabel_syntax::Expression; +use sqlbabel_syntax::expressions::names::models::Literal; +use sqlbabel_syntax::expressions::queries::models::Select; use sqlbuild_analysis::compiler::main::sql_test_fixture_facts::fixture_facts; -use sqlquack_syntax::Expression; -use sqlquack_syntax::expressions::names::models::Literal; -use sqlquack_syntax::expressions::queries::models::Select; use std::cell::RefCell; use std::collections::{BTreeMap, BTreeSet, HashMap}; use std::path::Path; diff --git a/crates/sqlbuild-sqltext/src/sql_scan/main/dialect_lexical_syntax.rs b/crates/sqlbuild-sqltext/src/sql_scan/main/dialect_lexical_syntax.rs index 09a09777d7..2e64481a60 100644 --- a/crates/sqlbuild-sqltext/src/sql_scan/main/dialect_lexical_syntax.rs +++ b/crates/sqlbuild-sqltext/src/sql_scan/main/dialect_lexical_syntax.rs @@ -2,7 +2,7 @@ use crate::sql_scan::models::LexicalSyntax; -/// The comment and quoted-text syntax that SQLQuack tokenizes for `dialect`. +/// The comment and quoted-text syntax that SQLBabel tokenizes for `dialect`. pub fn dialect_lexical_syntax(dialect: &str) -> LexicalSyntax { let strings = |quotes: &[&str]| quotes.iter().map(|quote| (*quote).to_owned()).collect(); let lines = |prefixes: &[&str]| prefixes.iter().map(|prefix| (*prefix).to_owned()).collect(); diff --git a/scripts/check_parse_guard.py b/scripts/check_parse_guard.py index d4cfa4af23..58550fe2db 100644 --- a/scripts/check_parse_guard.py +++ b/scripts/check_parse_guard.py @@ -6,7 +6,7 @@ def main(argv: list[str] | None = None) -> int: - """Check that Polyglot and SQLQuack's shared and Snowflake parses use the shared guard.""" + """Check that Polyglot and SQLBabel's shared and Snowflake parses use the shared guard.""" return run_parse_guard_check(argv) diff --git a/scripts/check_sqlbabel_pin.py b/scripts/check_sqlbabel_pin.py new file mode 100644 index 0000000000..dc9d0f90b4 --- /dev/null +++ b/scripts/check_sqlbabel_pin.py @@ -0,0 +1,14 @@ +"""Direct wrapper for the SQLBabel pin check.""" + +from __future__ import annotations + +from scripts.sqlbabel_pin.main.check import run_sqlbabel_pin_check + + +def main(argv: list[str] | None = None) -> int: + """Check that SQLBabel's Rust crates and Python package come from one release.""" + return run_sqlbabel_pin_check(argv) + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/scripts/parse_guard/_helpers/scan.py b/scripts/parse_guard/_helpers/scan.py index e0dcb10ee5..406ddd5bc0 100644 --- a/scripts/parse_guard/_helpers/scan.py +++ b/scripts/parse_guard/_helpers/scan.py @@ -1,4 +1,4 @@ -"""Find Polyglot and SQLQuack shared or Snowflake parses that use a library default depth.""" +"""Find Polyglot and SQLBabel shared or Snowflake parses that use a library default depth.""" from __future__ import annotations diff --git a/scripts/parse_guard/main/check.py b/scripts/parse_guard/main/check.py index 3ea1b44026..0708a9c8c6 100644 --- a/scripts/parse_guard/main/check.py +++ b/scripts/parse_guard/main/check.py @@ -7,13 +7,13 @@ def run_parse_guard_check(argv: list[str] | None = None) -> int: - """Fail when a Polyglot or SQLQuack shared or Snowflake parse uses a library default depth.""" + """Fail when a Polyglot or SQLBabel shared or Snowflake parse uses a library default depth.""" return run_root_check( argv=argv, description=__doc__, errors_under=get_parse_guard_errors, messages=( "Parse with sqlbuild_analysis::parse_guard's options, not a library default:", - "Polyglot, SQLQuack's shared and Snowflake parsers and SQLClean use the shared guard.", + "Polyglot, SQLBabel's shared and Snowflake parsers and SQLClean use the shared guard.", ), ) diff --git a/scripts/sqlbabel_pin/__init__.py b/scripts/sqlbabel_pin/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/scripts/sqlbabel_pin/_helpers/__init__.py b/scripts/sqlbabel_pin/_helpers/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/scripts/sqlbabel_pin/_helpers/pins.py b/scripts/sqlbabel_pin/_helpers/pins.py new file mode 100644 index 0000000000..b0a03e7742 --- /dev/null +++ b/scripts/sqlbabel_pin/_helpers/pins.py @@ -0,0 +1,113 @@ +"""SQLBabel's pins: the Python package's version and the commits the Rust crates build from.""" + +from __future__ import annotations + +import subprocess +import tomllib +from collections.abc import Callable, Mapping, Sequence +from pathlib import Path +from typing import Any + +from scripts.sqlbabel_pin.constants import ( + CARGO_FILE, + CARGO_LOCK_FILE, + EXACT_PIN, + PACKAGE_NAME, + PARSER_CRATE_PREFIXES, + PEELED_SUFFIX, + PYPROJECT_FILE, + SQLBABEL_GIT, + TAG_PREFIX, + TAGS_REF_PREFIX, +) + + +def python_version(pyproject: Mapping[str, Any]) -> str | None: + """The exact version `pyproject.toml` pins the sqlbabel package to, if it pins one.""" + requirement: str + for requirement in pyproject.get("project", {}).get("dependencies", ()): + name, separator, version = requirement.partition(EXACT_PIN) + if separator and name.strip() == PACKAGE_NAME: + return version.strip() + return None + + +def crate_revs(cargo: Mapping[str, Any]) -> dict[str, str | None]: + """Each workspace dependency on SQLBabel's repository and the git rev it pins, if any.""" + dependencies: Mapping[str, Any] = cargo.get("workspace", {}).get("dependencies", {}) + return { + name: spec.get("rev") + for name, spec in dependencies.items() + if isinstance(spec, Mapping) and spec.get("git") == SQLBABEL_GIT + } + + +def locked_sources(lock: Mapping[str, Any]) -> tuple[tuple[str, str], ...]: + """Every locked SQLBabel or SQLQuack crate's name, version and source, duplicates included.""" + return tuple( + (f"{package['name']} {package['version']}", package.get("source", "")) + for package in lock.get("package", ()) + if package["name"].startswith(PARSER_CRATE_PREFIXES) + ) + + +def tag_commit(version: str) -> str | None: + """The commit SQLBabel's release tag for `version` points at, or None without that tag.""" + tag: str = f"{TAGS_REF_PREFIX}{TAG_PREFIX}{version}" + listed: str = subprocess.run( + ["git", "ls-remote", SQLBABEL_GIT, tag, f"{tag}{PEELED_SUFFIX}"], + check=True, + capture_output=True, + text=True, + ).stdout + refs: dict[str, str] = {} + for line in listed.splitlines(): + sha, _, ref = line.partition("\t") + refs[ref] = sha + return refs.get(f"{tag}{PEELED_SUFFIX}", refs.get(tag)) + + +def pin_errors( + *, + version: str | None, + revs: Mapping[str, str | None], + locked: Sequence[tuple[str, str]], + commit_of: Callable[[str], str | None], +) -> tuple[str, ...]: + """Why the crates and the package are not pinned to the same SQLBabel release.""" + if version is None: + return (f"{PYPROJECT_FILE} does not pin {PACKAGE_NAME} with {EXACT_PIN}",) + if not revs: + return (f"{CARGO_FILE} has no dependency on {SQLBABEL_GIT}",) + commit: str | None = commit_of(version) + if commit is None: + return (f"{SQLBABEL_GIT} has no tag {TAG_PREFIX}{version}",) + pinned: tuple[str, ...] = tuple( + f"{CARGO_FILE} pins {name} to rev {rev}, not {commit}, the commit of " + f"{TAG_PREFIX}{version} that {PYPROJECT_FILE} pins" + for name, rev in sorted(revs.items()) + if rev != commit + ) + expected: str = f"git+{SQLBABEL_GIT}?rev={commit}#{commit}" + return pinned + tuple( + f"{CARGO_LOCK_FILE} builds {package} from {source or 'a path'}, not {expected}; " + f"move the dependency that needs it to {TAG_PREFIX}{version}" + for package, source in sorted(locked) + if source != expected + ) + + +def get_sqlbabel_pin_errors(root: Path) -> tuple[str, ...]: + """Why the repository at `root` pins SQLBabel's crates and package to different releases.""" + with (root / PYPROJECT_FILE).open("rb") as pyproject_file: + pyproject: dict[str, Any] = tomllib.load(pyproject_file) + with (root / CARGO_FILE).open("rb") as cargo_file: + cargo: dict[str, Any] = tomllib.load(cargo_file) + with (root / CARGO_LOCK_FILE).open("rb") as lock_file: + lock: dict[str, Any] = tomllib.load(lock_file) + return pin_errors( + version=python_version(pyproject), + revs=crate_revs(cargo), + locked=locked_sources(lock), + commit_of=tag_commit, + ) diff --git a/scripts/sqlbabel_pin/constants.py b/scripts/sqlbabel_pin/constants.py new file mode 100644 index 0000000000..49025affa7 --- /dev/null +++ b/scripts/sqlbabel_pin/constants.py @@ -0,0 +1,12 @@ +"""Where SQLBuild pins SQLBabel: the Python package and the Rust crates of one release.""" + +PYPROJECT_FILE: str = "pyproject.toml" +CARGO_FILE: str = "Cargo.toml" +CARGO_LOCK_FILE: str = "Cargo.lock" +PACKAGE_NAME: str = "sqlbabel" +EXACT_PIN: str = "==" +SQLBABEL_GIT: str = "https://github.com/sqlstack-io/sqlbabel.git" +PARSER_CRATE_PREFIXES: tuple[str, ...] = ("sqlbabel", "sqlquack") +TAG_PREFIX: str = "v" +PEELED_SUFFIX: str = "^{}" +TAGS_REF_PREFIX: str = "refs/tags/" diff --git a/scripts/sqlbabel_pin/main/__init__.py b/scripts/sqlbabel_pin/main/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/scripts/sqlbabel_pin/main/check.py b/scripts/sqlbabel_pin/main/check.py new file mode 100644 index 0000000000..dc692bcc0e --- /dev/null +++ b/scripts/sqlbabel_pin/main/check.py @@ -0,0 +1,19 @@ +"""SQLBabel pin check command entrypoint.""" + +from __future__ import annotations + +from scripts.root_check.main.run_root_check import run_root_check +from scripts.sqlbabel_pin._helpers.pins import get_sqlbabel_pin_errors + + +def run_sqlbabel_pin_check(argv: list[str] | None = None) -> int: + """Fail unless the Rust crates build from the tag of the Python package's SQLBabel release.""" + return run_root_check( + argv=argv, + description=__doc__, + errors_under=get_sqlbabel_pin_errors, + messages=( + "Pin SQLBabel's Rust crates to the release tag of the Python package's version:", + "SQLBabel's Rust crates and Python package come from the same release.", + ), + ) diff --git a/src/sqlbuild/.agents/skills/sqlbuild/references/docs/concepts/rules/custom-rules/rule-context.md b/src/sqlbuild/.agents/skills/sqlbuild/references/docs/concepts/rules/custom-rules/rule-context.md index c6be80f9c2..6c6fd04c49 100644 --- a/src/sqlbuild/.agents/skills/sqlbuild/references/docs/concepts/rules/custom-rules/rule-context.md +++ b/src/sqlbuild/.agents/skills/sqlbuild/references/docs/concepts/rules/custom-rules/rule-context.md @@ -95,7 +95,7 @@ for node in sql.ast().walk(): `ast()` returns a `document` node whose children are the statements. Every `SqlTreeNode` has a `kind`, a `line` and `column` where it starts, `children`, and `walk()`, which yields the node and -its descendants in pre-order. Kinds are SQLQuack's snake_case names, such as `select`, `subquery`, +its descendants in pre-order. Kinds are SQLBabel's snake_case names, such as `select`, `subquery`, `star`, `join`, `cte`, `alias`, `column`, `table`, `literal`, `function` and `window_function`. A statement's clauses are nodes too, each owning the expressions written in it, so a rule can look @@ -155,12 +155,12 @@ the marker call as written. Parsing is lazy. A path or contract Rule does not pay for SQL parsing merely because syntax tree access exists elsewhere. -The tree comes from the SQLQuack parser SQLBuild uses for the project's dialect: +The tree comes from the SQLBabel parser SQLBuild uses for the project's dialect: | Dialect | Syntax tree | | --- | --- | | PostgreSQL | Native PostgreSQL parser | -| DuckDB, MotherDuck, Snowflake, SQLite | SQLQuack's shared parser | +| DuckDB, MotherDuck, Snowflake, SQLite | SQLBabel's shared parser | | Other dialects | Unavailable | A node without a source span has no end: `end_line`, `end_column` and `span` are `None`, and it diff --git a/src/sqlbuild/_native.pyi b/src/sqlbuild/_native.pyi index 201cb631f9..8523c4ee2e 100644 --- a/src/sqlbuild/_native.pyi +++ b/src/sqlbuild/_native.pyi @@ -4385,7 +4385,7 @@ class NativeModelValidator: ) -> int | NativeConfigError | None: ... class SqlDocument: - """One SQL text a custom rule reads, parsed on first use by its dialect's SQLQuack parser.""" + """One SQL text a custom rule reads, parsed on first use by its dialect's SQLBabel parser.""" source: str def __init__( diff --git a/tests/integration/src/sqlbuild/compiler/semantic_checks/test_native_semantic_checks.py b/tests/integration/src/sqlbuild/compiler/semantic_checks/test_native_semantic_checks.py index d7dcfc8d63..499fafc46e 100644 --- a/tests/integration/src/sqlbuild/compiler/semantic_checks/test_native_semantic_checks.py +++ b/tests/integration/src/sqlbuild/compiler/semantic_checks/test_native_semantic_checks.py @@ -237,7 +237,7 @@ def test_given_one_model_under_its_dialect_when_completing_natively_then_has_exp @pytest.mark.xfail( strict=True, - reason="SQLQuack's Snowflake and BigQuery profiles do not yet check or type these", + reason="SQLBabel's Snowflake and BigQuery profiles do not yet check or type these", ) @pytest.mark.parametrize( "test_case", @@ -302,7 +302,7 @@ def test_given_cte_over_failed_upstream_when_completing_natively_then_model_keep @pytest.mark.xfail( strict=True, reason=( - "SQLQuack drops PostgreSQL's follow-on finding of a CTE whose own finding type " + "SQLBabel drops PostgreSQL's follow-on finding of a CTE whose own finding type " "recovery then drops as poisoned, so the model is left with none" ), ) diff --git a/tests/unit/scripts/parse_guard/_helpers/test_scan.py b/tests/unit/scripts/parse_guard/_helpers/test_scan.py index 2a575e361a..aa4ef177ad 100644 --- a/tests/unit/scripts/parse_guard/_helpers/test_scan.py +++ b/tests/unit/scripts/parse_guard/_helpers/test_scan.py @@ -23,7 +23,7 @@ ), ), UnguardedSiteTestCase( - description="SQLQuack's default options", + description="SQLBabel's default options", text="fn b() { parse_strict(sql, d, &ParseOptions::default()); }", expected_sites=(r"x.rs:1 ParseOptions::default\(\)",), ), @@ -51,12 +51,12 @@ ), UnguardedSiteTestCase( description=( - "SQLQuack's per-dialect parsers are excluded: they take no options and keep their " - "own depth limits until SQLQuack accepts options for them" + "SQLBabel's per-dialect parsers are excluded: they take no options and keep their " + "own depth limits until SQLBabel accepts options for them" ), text=( - "fn k() { sqlquack_syntax_postgres::parse_strict(sql) }\n" - "fn l() { sqlquack_syntax_bigquery::parse_type(spelling) }\n" + "fn k() { sqlbabel_syntax_postgres::parse_strict(sql) }\n" + "fn l() { sqlbabel_syntax_bigquery::parse_type(spelling) }\n" "fn m(parser: &dyn NativeDialect) { parser.parse(sql) }\n" ), expected_sites=(), diff --git a/tests/unit/scripts/sqlbabel_pin/__init__.py b/tests/unit/scripts/sqlbabel_pin/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/scripts/sqlbabel_pin/_helpers/__init__.py b/tests/unit/scripts/sqlbabel_pin/_helpers/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/scripts/sqlbabel_pin/_helpers/_test_types.py b/tests/unit/scripts/sqlbabel_pin/_helpers/_test_types.py new file mode 100644 index 0000000000..ad0e0cba42 --- /dev/null +++ b/tests/unit/scripts/sqlbabel_pin/_helpers/_test_types.py @@ -0,0 +1,12 @@ +from collections.abc import Mapping +from dataclasses import dataclass + + +@dataclass(frozen=True) +class SqlBabelPinTestCase: + description: str + dependencies: tuple[str, ...] + workspace_dependencies: Mapping[str, object] + tags: Mapping[str, str] + lock_sources: tuple[tuple[str, str], ...] + expected_errors: tuple[str, ...] diff --git a/tests/unit/scripts/sqlbabel_pin/_helpers/test_pins.py b/tests/unit/scripts/sqlbabel_pin/_helpers/test_pins.py new file mode 100644 index 0000000000..73401d5aa6 --- /dev/null +++ b/tests/unit/scripts/sqlbabel_pin/_helpers/test_pins.py @@ -0,0 +1,171 @@ +import pytest + +from scripts.sqlbabel_pin._helpers.pins import ( + crate_revs, + locked_sources, + pin_errors, + python_version, +) +from tests.unit.scripts.sqlbabel_pin._helpers._test_types import SqlBabelPinTestCase + +_GIT: str = "https://github.com/sqlstack-io/sqlbabel.git" +_TAGGED: str = "a" * 40 +_OTHER: str = "b" * 40 +_RETIRED: str = "https://github.com/sqlstack-io/sqlquack.git" + + +@pytest.mark.parametrize( + "test_case", + [ + SqlBabelPinTestCase( + description="every crate at the tag of the pinned package", + dependencies=("sqlbabel-cli==0.40.0", "sqlbabel==0.39.0"), + workspace_dependencies={ + "sqlbabel-parse": {"git": _GIT, "rev": _TAGGED}, + "sqlbabel-syntax": {"git": _GIT, "rev": _TAGGED, "features": ["duckdb"]}, + "sqlclean": {"git": "https://github.com/sqlstack-io/sqlclean.git", "rev": _OTHER}, + "stacker": "0.1", + }, + tags={"0.39.0": _TAGGED, "0.40.0": _OTHER}, + lock_sources=( + ("sqlbabel-parse", f"git+{_GIT}?rev={_TAGGED}#{_TAGGED}"), + ( + "sqlclean", + f"git+https://github.com/sqlstack-io/sqlclean.git?rev={_OTHER}#{_OTHER}", + ), + ("stacker", "registry+https://github.com/rust-lang/crates.io-index"), + ), + expected_errors=(), + ), + SqlBabelPinTestCase( + description="one crate left on another commit", + dependencies=("sqlbabel==0.39.0",), + workspace_dependencies={ + "sqlbabel-syntax": {"git": _GIT, "rev": _TAGGED}, + "sqlbabel-parse": {"git": _GIT, "rev": _OTHER}, + }, + tags={"0.39.0": _TAGGED}, + lock_sources=(), + expected_errors=( + f"Cargo.toml pins sqlbabel-parse to rev {_OTHER}, not {_TAGGED}, the commit of " + "v0.39.0 that pyproject.toml pins", + ), + ), + SqlBabelPinTestCase( + description="a crate on a branch has no rev", + dependencies=("sqlbabel==0.39.0",), + workspace_dependencies={"sqlbabel-parse": {"git": _GIT, "branch": "main"}}, + tags={"0.39.0": _TAGGED}, + lock_sources=(), + expected_errors=( + f"Cargo.toml pins sqlbabel-parse to rev None, not {_TAGGED}, the commit of " + "v0.39.0 that pyproject.toml pins", + ), + ), + SqlBabelPinTestCase( + description="the pinned version has no release tag", + dependencies=("sqlbabel==0.39.0",), + workspace_dependencies={"sqlbabel-parse": {"git": _GIT, "rev": _TAGGED}}, + tags={"0.38.0": _TAGGED}, + lock_sources=(), + expected_errors=(f"{_GIT} has no tag v0.39.0",), + ), + SqlBabelPinTestCase( + description="the package is a range, not an exact pin", + dependencies=("sqlbabel>=0.39.0",), + workspace_dependencies={"sqlbabel-parse": {"git": _GIT, "rev": _TAGGED}}, + tags={"0.39.0": _TAGGED}, + lock_sources=(), + expected_errors=("pyproject.toml does not pin sqlbabel with ==",), + ), + SqlBabelPinTestCase( + description="no crate depends on SQLBabel", + dependencies=("sqlbabel==0.39.0",), + workspace_dependencies={"stacker": "0.1"}, + tags={"0.39.0": _TAGGED}, + lock_sources=(), + expected_errors=(f"Cargo.toml has no dependency on {_GIT}",), + ), + SqlBabelPinTestCase( + description="another dependency still builds SQLQuack's parser", + dependencies=("sqlbabel==0.39.0",), + workspace_dependencies={"sqlbabel-parse": {"git": _GIT, "rev": _TAGGED}}, + tags={"0.39.0": _TAGGED}, + lock_sources=( + ("sqlbabel-parse", f"git+{_GIT}?rev={_TAGGED}#{_TAGGED}"), + ("sqlquack-parse", f"git+{_RETIRED}?rev={_OTHER}#{_OTHER}"), + ), + expected_errors=( + f"Cargo.lock builds sqlquack-parse 0.1.0 from git+{_RETIRED}?rev={_OTHER}#{_OTHER}, " + f"not git+{_GIT}?rev={_TAGGED}#{_TAGGED}; move the dependency that needs it to v0.39.0", + ), + ), + SqlBabelPinTestCase( + description="another dependency builds SQLBabel at another commit", + dependencies=("sqlbabel==0.39.0",), + workspace_dependencies={"sqlbabel-parse": {"git": _GIT, "rev": _TAGGED}}, + tags={"0.39.0": _TAGGED}, + lock_sources=(("sqlbabel-syntax", f"git+{_GIT}?rev={_OTHER}#{_OTHER}"),), + expected_errors=( + f"Cargo.lock builds sqlbabel-syntax 0.1.0 from git+{_GIT}?rev={_OTHER}#{_OTHER}, " + f"not git+{_GIT}?rev={_TAGGED}#{_TAGGED}; move the dependency that needs it to v0.39.0", + ), + ), + SqlBabelPinTestCase( + description="a second build of the same crate sorts before the tagged one", + dependencies=("sqlbabel==0.39.0",), + workspace_dependencies={"sqlbabel-syntax": {"git": _GIT, "rev": _TAGGED}}, + tags={"0.39.0": _OTHER}, + lock_sources=( + ("sqlbabel-syntax", f"git+{_GIT}?rev={_TAGGED}#{_TAGGED}"), + ("sqlbabel-syntax", f"git+{_GIT}?rev={_OTHER}#{_OTHER}"), + ), + expected_errors=( + f"Cargo.toml pins sqlbabel-syntax to rev {_TAGGED}, not {_OTHER}, the commit of " + "v0.39.0 that pyproject.toml pins", + f"Cargo.lock builds sqlbabel-syntax 0.1.0 from git+{_GIT}?rev={_TAGGED}#{_TAGGED}, " + f"not git+{_GIT}?rev={_OTHER}#{_OTHER}; move the dependency that needs it to v0.39.0", + ), + ), + SqlBabelPinTestCase( + description="the tagged commit reached through a tag or another URL spelling", + dependencies=("sqlbabel==0.39.0",), + workspace_dependencies={"sqlbabel-parse": {"git": _GIT, "rev": _TAGGED}}, + tags={"0.39.0": _TAGGED}, + lock_sources=( + ("sqlbabel-parse", f"git+{_GIT}?rev={_TAGGED}#{_TAGGED}"), + ("sqlbabel-syntax", f"git+{_GIT}?tag=v0.39.0#{_TAGGED}"), + ( + "sqlbabel-tokenize", + f"git+https://github.com/sqlstack-io/sqlbabel?rev={_TAGGED}#{_TAGGED}", + ), + ), + expected_errors=( + f"Cargo.lock builds sqlbabel-syntax 0.1.0 from git+{_GIT}?tag=v0.39.0#{_TAGGED}, " + f"not git+{_GIT}?rev={_TAGGED}#{_TAGGED}; move the dependency that needs it to v0.39.0", + "Cargo.lock builds sqlbabel-tokenize 0.1.0 from " + f"git+https://github.com/sqlstack-io/sqlbabel?rev={_TAGGED}#{_TAGGED}, " + f"not git+{_GIT}?rev={_TAGGED}#{_TAGGED}; move the dependency that needs it to v0.39.0", + ), + ), + ], + ids=lambda case: case.description, +) +def test_given_sqlbabel_pins_when_checked_then_crates_must_build_from_the_package_release_tag( + test_case: SqlBabelPinTestCase, +) -> None: + errors: tuple[str, ...] = pin_errors( + version=python_version({"project": {"dependencies": list(test_case.dependencies)}}), + revs=crate_revs({"workspace": {"dependencies": dict(test_case.workspace_dependencies)}}), + locked=locked_sources( + { + "package": [ + {"name": name, "version": "0.1.0", "source": source} + for name, source in test_case.lock_sources + ] + } + ), + commit_of=test_case.tags.get, + ) + + assert errors == test_case.expected_errors diff --git a/website/src/content/docs/docs/concepts/rules/custom-rules/rule-context.mdx b/website/src/content/docs/docs/concepts/rules/custom-rules/rule-context.mdx index 4bc8801d25..d478a567f2 100644 --- a/website/src/content/docs/docs/concepts/rules/custom-rules/rule-context.mdx +++ b/website/src/content/docs/docs/concepts/rules/custom-rules/rule-context.mdx @@ -83,7 +83,7 @@ for node in sql.ast().walk(): `ast()` returns a `document` node whose children are the statements. Every `SqlTreeNode` has a `kind`, a `line` and `column` where it starts, `children`, and `walk()`, which yields the node and -its descendants in pre-order. Kinds are SQLQuack's snake_case names, such as `select`, `subquery`, +its descendants in pre-order. Kinds are SQLBabel's snake_case names, such as `select`, `subquery`, `star`, `join`, `cte`, `alias`, `column`, `table`, `literal`, `function` and `window_function`. A statement's clauses are nodes too, each owning the expressions written in it, so a rule can look @@ -143,12 +143,12 @@ the marker call as written. Parsing is lazy. A path or contract Rule does not pay for SQL parsing merely because syntax tree access exists elsewhere. -The tree comes from the SQLQuack parser SQLBuild uses for the project's dialect: +The tree comes from the SQLBabel parser SQLBuild uses for the project's dialect: | Dialect | Syntax tree | | --- | --- | | PostgreSQL | Native PostgreSQL parser | -| DuckDB, MotherDuck, Snowflake, SQLite | SQLQuack's shared parser | +| DuckDB, MotherDuck, Snowflake, SQLite | SQLBabel's shared parser | | Other dialects | Unavailable | A node without a source span has no end: `end_line`, `end_column` and `span` are `None`, and it