Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 34 additions & 34 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -176,22 +176,22 @@ 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 = "be41ae207344e127db81aa42d6a951682c3f35fa" }
sqlclean = { git = "https://github.com/sqlstack-io/sqlclean.git", rev = "6e18af661ce3a6bcc385a38954c86696d722f400" }
# SQL change fingerprints over SQLQuack's tokenizers.
sqlquack-fingerprint = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "e1a583eb6d4180ff4121ef82b3f08b2982edca66", features = ["bigquery", "databricks", "duckdb", "postgres", "snowflake", "sqlite", "sqlserver"] }
sqlquack-fingerprint = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "8d28aa4c4b6c3d8c5345ddef3d620fa24e26741a", 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 = "e1a583eb6d4180ff4121ef82b3f08b2982edca66", features = ["bigquery", "clickhouse", "databricks", "duckdb", "postgres", "snowflake", "sqlite", "sqlserver"] }
sqlquack-semantics = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "8d28aa4c4b6c3d8c5345ddef3d620fa24e26741a", 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 = "e1a583eb6d4180ff4121ef82b3f08b2982edca66" }
sqlquack-parse = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "8d28aa4c4b6c3d8c5345ddef3d620fa24e26741a" }
# SQLQuack's syntax tree and lossless tokens.
sqlquack-syntax = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "e1a583eb6d4180ff4121ef82b3f08b2982edca66" }
sqlquack-syntax-bigquery = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "e1a583eb6d4180ff4121ef82b3f08b2982edca66" }
sqlquack-syntax-clickhouse = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "e1a583eb6d4180ff4121ef82b3f08b2982edca66" }
sqlquack-syntax-databricks = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "e1a583eb6d4180ff4121ef82b3f08b2982edca66" }
sqlquack-syntax-duckdb = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "e1a583eb6d4180ff4121ef82b3f08b2982edca66" }
sqlquack-syntax-postgres = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "e1a583eb6d4180ff4121ef82b3f08b2982edca66" }
sqlquack-syntax-sqlite = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "e1a583eb6d4180ff4121ef82b3f08b2982edca66" }
sqlquack-syntax-sqlserver = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "e1a583eb6d4180ff4121ef82b3f08b2982edca66" }
sqlquack-syntax = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "8d28aa4c4b6c3d8c5345ddef3d620fa24e26741a" }
sqlquack-syntax-bigquery = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "8d28aa4c4b6c3d8c5345ddef3d620fa24e26741a" }
sqlquack-syntax-clickhouse = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "8d28aa4c4b6c3d8c5345ddef3d620fa24e26741a" }
sqlquack-syntax-databricks = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "8d28aa4c4b6c3d8c5345ddef3d620fa24e26741a" }
sqlquack-syntax-duckdb = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "8d28aa4c4b6c3d8c5345ddef3d620fa24e26741a" }
sqlquack-syntax-postgres = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "8d28aa4c4b6c3d8c5345ddef3d620fa24e26741a" }
sqlquack-syntax-sqlite = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "8d28aa4c4b6c3d8c5345ddef3d620fa24e26741a" }
sqlquack-syntax-sqlserver = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "8d28aa4c4b6c3d8c5345ddef3d620fa24e26741a" }
stacker = "0.1"
syn = { version = "2", features = ["full", "visit", "extra-traits"] }
subtle = "2"
Expand Down
8 changes: 4 additions & 4 deletions crates/sqlbuild-analysis/src/sql_tree/tests/test_sql_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ fn given_sql_when_building_a_rule_tree_then_clauses_own_their_queries_at_their_s
],
},
TreeShapeTestCase {
description: "the shared DuckDB parser leaves a bare star and a subquery's select at their parent's position",
description: "the shared DuckDB parser records a bare star at its own position and a subquery's select at its parent's",
dialect: "duckdb",
sql: CTE_AND_JOIN_SQL,
expected_nodes: vec![
("select", 1, 1, None),
("star", 1, 1, Some("select")),
("cte", 1, 6, Some("select")),
("select", 1, 12, Some("cte")),
("star", 2, 8, Some("select")),
("join", 3, 10, Some("select")),
("select", 3, 15, Some("subquery")),
("subquery", 3, 15, Some("join")),
Expand All @@ -58,7 +58,7 @@ fn given_sql_when_building_a_rule_tree_then_clauses_own_their_queries_at_their_s
("select", 1, 1, None),
("cte", 1, 6, Some("select")),
("select", 1, 12, Some("cte")),
("star", 1, 12, Some("select")),
("star", 1, 19, Some("select")),
("star", 2, 8, Some("select")),
("join", 3, 8, Some("select")),
("join", 3, 49, Some("select")),
Expand Down Expand Up @@ -86,8 +86,8 @@ fn given_sql_when_building_a_rule_tree_then_clauses_own_their_queries_at_their_s
expected_nodes: vec![
("select", 1, 1, None),
("select", 2, 6, Some("subquery")),
("star", 2, 6, Some("select")),
("subquery", 2, 6, Some("select")),
("star", 2, 14, Some("select")),
("join", 2, 43, Some("select")),
("select", 2, 48, Some("subquery")),
("subquery", 2, 48, Some("join")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ fn given_sql_test_shapes_when_evaluating_empty_input_rule_then_flags_only_filler
),
allowed_tests: json!([]),
expected_messages: &[
"SQBRTEST203 tests/unit/test_orders__empty_inputs_produce_no_rows.sql: Rule SQBRTEST203 could not be evaluated for test block 1: could not parse SQL-test fixture: Parse error at line 1, column 42: Unexpected token: Limit",
"SQBRTEST203 tests/unit/test_orders__empty_inputs_produce_no_rows.sql: Rule SQBRTEST203 could not be evaluated for test block 1: could not parse SQL-test fixture: Parse error at line 1, column 42: Expected an expression after LIMIT",
],
},
test_types::EmptyInputTestRuleTestCase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ fn given_snowflake_table_function_calls_when_formatting_then_each_call_is_kept_w
contents: "MODEL ();\nselect t.a from t join lateral __table_fn(\"f\")(t.x) as l on true\n",
expected_formatted: vec![(
0,
"MODEL ();\nSELECT t.a\nFROM t\nJOIN LATERAL __table_fn(\"f\")(t.x) AS l\n ON TRUE\n"
"MODEL ();\nSELECT t.a\nFROM t\nJOIN LATERAL __table_fn(\"f\")(t.x) AS l ON TRUE\n"
.to_string(),
)],
expected_fault_lines: vec![],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def test_given_model_query_layout_when_running_rules_then_findings_use_file_posi
expected_messages=(
"CTE/3:o AS",
"Join/3:JOIN",
"Star/3:HASH",
"Star/3:*) A",
"Star/3:o.*,",
"Subquery/3:(SEL",
),
Expand All @@ -156,7 +156,7 @@ def test_given_model_query_layout_when_running_rules_then_findings_use_file_posi
)
for name in ("customers", "raw_orders")
},
expected_messages=("CTE/2:c AS", "Join/2:JOIN", "Star/2:SELE", "Star/2:o.*,"),
expected_messages=("CTE/2:c AS", "Join/2:JOIN", "Star/2:* FR", "Star/2:o.*,"),
),
],
ids=lambda case: case.description,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,7 @@ def test_given_select_all_and_implicit_aliases_when_formatting_then_only_layout_
" o.order_id,\n"
" CAST(\n"
" COALESCE(o.amount, o.fallback_amount, 0)\n"
" + o.tax AS decimal(18, 2)\n"
" + o.tax AS decimal(18, 2)\n"
" ) AS total\n"
" FROM orders o\n"
" WHERE o.amount > 0\n"
Expand All @@ -1336,8 +1336,7 @@ def test_given_select_all_and_implicit_aliases_when_formatting_then_only_layout_
" p.order_id,\n"
" p.total\n"
"FROM paid p\n"
"JOIN labels l\n"
" ON p.order_id = l.order_id\n"
"JOIN labels l ON p.order_id = l.order_id\n"
),
),
],
Expand Down
Loading