diff --git a/README.md b/README.md index 6abf25855..38fcf1a98 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,8 @@ SQL that runs on two engines doesn't always return the same answer. NULLs, decim SQLQuack checks its conversion rules against real results from the source warehouse. It handles those differences deliberately and gives you precise diagnostics when it can't convert a query - not plausible-looking SQL and crossed fingers. +SQLQuack's parser started as a fork of [Polyglot](https://github.com/tobilg/polyglot), which is itself a Rust port of [SQLGlot](https://github.com/tobymao/sqlglot). The translation to DuckDB, the typing and the recorded evidence behind them are SQLQuack's own. + - **Check early.** Catch invalid SQL before it reaches the warehouse. - **Test locally.** Convert queries to DuckDB SQL for tests against small fixtures. - **See what's blocking you.** Scan a SQL project to find what converts and what needs attention. @@ -93,6 +95,17 @@ A pull request runs what its changed files need. Documentation and website chang Recording needs the dialect's engine: DuckDB and SQLite record locally, while Snowflake, BigQuery and Databricks need a connection. Recording Snowflake syntax evidence isn't public yet. `make help` lists every target. +## Credits + +SQLQuack wouldn't exist without two projects: + +- **[Polyglot](https://github.com/tobilg/polyglot)** by Tobias ([@tobilg](https://github.com/tobilg)). SQLQuack's tokenizer, parser and syntax tree are a modified fork of Polyglot's, and much of that code is still his. Tobias also fixed many issues I reported while building SQLBuild on Polyglot. +- **[SQLGlot](https://github.com/tobymao/sqlglot)** by Toby Mao and contributors. Polyglot is based on SQLGlot's design, and so is SQLQuack's parser. + +Both are MIT licensed. Their licence texts are in [THIRD_PARTY_NOTICES](THIRD_PARTY_NOTICES) and ship with every release. + +SQLQuack goes a different way from both on translation. It doesn't rewrite the tree and print it out. It checks each rule against recorded warehouse results and refuses what it can't prove. + --- Built in Rust. Free and open source. [Apache 2.0](https://github.com/sqlstack-io/sqlquack/blob/main/LICENSE). diff --git a/THIRD_PARTY_NOTICES b/THIRD_PARTY_NOTICES index a36f6dedf..de5b44d4b 100644 --- a/THIRD_PARTY_NOTICES +++ b/THIRD_PARTY_NOTICES @@ -57,14 +57,19 @@ SOFTWARE. polyglot -------- -Parts of SQLQuack's tokenizer and parser, in crates/sqlquack-syntax and -crates/sqlquack-derive, are derived from polyglot (https://github.com/tobilg/polyglot), -as forked at https://github.com/sqlstack-io/polyglot. The exact-check corpus +SQLQuack's tokenizer, parser and syntax tree are a modified fork of polyglot +(https://github.com/tobilg/polyglot), as forked at https://github.com/sqlstack-io/polyglot. +The derived code is in crates/sqlquack-syntax-snowflake, which now holds most of it, +crates/sqlquack-syntax and crates/sqlquack-derive. The exact-check corpus corpora/polyglot-check/polyglot_tests.json holds the SQL inputs of polyglot's tests. -SQLQuack's DuckDB result-type rules, in crates/sqlquack-semantics/src/lineage/_helpers/duckdb_typing.rs -and duckdb_types.rs, are ported from polyglot's engine type rules, and the fixture -crates/sqlquack-semantics/src/lineage/tests/fixtures/duckdb_engine_types.json is polyglot's +SQLQuack's DuckDB result-type rules, in crates/sqlquack-semantics/src/duckdb/profile/_helpers/typing.rs, +are ported from polyglot's engine type rules, and the fixture +crates/sqlquack-semantics/src/duckdb/profile/tests/fixtures/duckdb_engine_types.json is polyglot's tests/fixtures/engine_types/duckdb.json, the result types DuckDB bound for its synthetic cases. +The semantic checks in crates/sqlquack-semantics/src/lineage/_helpers/checks are ported from +polyglot's validation: the type families in families.rs, the built-in function signatures in +signatures.rs and the scope rules in scope_rules.rs, and the type checks and their messages in +node_checks.rs, relational.rs and sets.rs. The lint Rules' scope walk and aggregate classifier, in crates/sqlquack-lint/src/tree, are ported from polyglot's scope.rs and traversal.rs. diff --git a/crates/sqlquack/THIRD_PARTY_NOTICES b/crates/sqlquack/THIRD_PARTY_NOTICES index a36f6dedf..de5b44d4b 100644 --- a/crates/sqlquack/THIRD_PARTY_NOTICES +++ b/crates/sqlquack/THIRD_PARTY_NOTICES @@ -57,14 +57,19 @@ SOFTWARE. polyglot -------- -Parts of SQLQuack's tokenizer and parser, in crates/sqlquack-syntax and -crates/sqlquack-derive, are derived from polyglot (https://github.com/tobilg/polyglot), -as forked at https://github.com/sqlstack-io/polyglot. The exact-check corpus +SQLQuack's tokenizer, parser and syntax tree are a modified fork of polyglot +(https://github.com/tobilg/polyglot), as forked at https://github.com/sqlstack-io/polyglot. +The derived code is in crates/sqlquack-syntax-snowflake, which now holds most of it, +crates/sqlquack-syntax and crates/sqlquack-derive. The exact-check corpus corpora/polyglot-check/polyglot_tests.json holds the SQL inputs of polyglot's tests. -SQLQuack's DuckDB result-type rules, in crates/sqlquack-semantics/src/lineage/_helpers/duckdb_typing.rs -and duckdb_types.rs, are ported from polyglot's engine type rules, and the fixture -crates/sqlquack-semantics/src/lineage/tests/fixtures/duckdb_engine_types.json is polyglot's +SQLQuack's DuckDB result-type rules, in crates/sqlquack-semantics/src/duckdb/profile/_helpers/typing.rs, +are ported from polyglot's engine type rules, and the fixture +crates/sqlquack-semantics/src/duckdb/profile/tests/fixtures/duckdb_engine_types.json is polyglot's tests/fixtures/engine_types/duckdb.json, the result types DuckDB bound for its synthetic cases. +The semantic checks in crates/sqlquack-semantics/src/lineage/_helpers/checks are ported from +polyglot's validation: the type families in families.rs, the built-in function signatures in +signatures.rs and the scope rules in scope_rules.rs, and the type checks and their messages in +node_checks.rs, relational.rs and sets.rs. The lint Rules' scope walk and aggregate classifier, in crates/sqlquack-lint/src/tree, are ported from polyglot's scope.rs and traversal.rs. diff --git a/python/THIRD_PARTY_NOTICES b/python/THIRD_PARTY_NOTICES index a36f6dedf..de5b44d4b 100644 --- a/python/THIRD_PARTY_NOTICES +++ b/python/THIRD_PARTY_NOTICES @@ -57,14 +57,19 @@ SOFTWARE. polyglot -------- -Parts of SQLQuack's tokenizer and parser, in crates/sqlquack-syntax and -crates/sqlquack-derive, are derived from polyglot (https://github.com/tobilg/polyglot), -as forked at https://github.com/sqlstack-io/polyglot. The exact-check corpus +SQLQuack's tokenizer, parser and syntax tree are a modified fork of polyglot +(https://github.com/tobilg/polyglot), as forked at https://github.com/sqlstack-io/polyglot. +The derived code is in crates/sqlquack-syntax-snowflake, which now holds most of it, +crates/sqlquack-syntax and crates/sqlquack-derive. The exact-check corpus corpora/polyglot-check/polyglot_tests.json holds the SQL inputs of polyglot's tests. -SQLQuack's DuckDB result-type rules, in crates/sqlquack-semantics/src/lineage/_helpers/duckdb_typing.rs -and duckdb_types.rs, are ported from polyglot's engine type rules, and the fixture -crates/sqlquack-semantics/src/lineage/tests/fixtures/duckdb_engine_types.json is polyglot's +SQLQuack's DuckDB result-type rules, in crates/sqlquack-semantics/src/duckdb/profile/_helpers/typing.rs, +are ported from polyglot's engine type rules, and the fixture +crates/sqlquack-semantics/src/duckdb/profile/tests/fixtures/duckdb_engine_types.json is polyglot's tests/fixtures/engine_types/duckdb.json, the result types DuckDB bound for its synthetic cases. +The semantic checks in crates/sqlquack-semantics/src/lineage/_helpers/checks are ported from +polyglot's validation: the type families in families.rs, the built-in function signatures in +signatures.rs and the scope rules in scope_rules.rs, and the type checks and their messages in +node_checks.rs, relational.rs and sets.rs. The lint Rules' scope walk and aggregate classifier, in crates/sqlquack-lint/src/tree, are ported from polyglot's scope.rs and traversal.rs. diff --git a/website/src/content/docs/docs/credits.mdx b/website/src/content/docs/docs/credits.mdx index c8c689b05..dc1230b11 100644 --- a/website/src/content/docs/docs/credits.mdx +++ b/website/src/content/docs/docs/credits.mdx @@ -3,14 +3,22 @@ title: "Credits" description: "The open-source projects SQLQuack builds on." --- -SQLQuack's tokenizer and parser started from code derived from -[Polyglot](https://github.com/tobilg/polyglot), by Tobias -([@tobilg](https://github.com/tobilg)). Its DuckDB result-type rules are ported from Polyglot's -engine type rules. Thank you, Tobias. +SQLQuack wouldn't exist without two projects: -Thanks also to [SQLGlot](https://github.com/tobymao/sqlglot), by Toby Mao. Polyglot is inspired by -SQLGlot, and SQLQuack uses the Snowflake SQL of SQLGlot's test suite as case inputs, with the -expected answers recorded from Snowflake itself. +- **[Polyglot](https://github.com/tobilg/polyglot)** by Tobias + ([@tobilg](https://github.com/tobilg)). SQLQuack's tokenizer, parser and syntax tree are a + modified fork of Polyglot's, and much of that code is still his. Its DuckDB result-type rules + and its semantic checks are also ported from Polyglot. +- **[SQLGlot](https://github.com/tobymao/sqlglot)** by Toby Mao and contributors. Polyglot is a + Rust port of SQLGlot and is based on its design, and so is SQLQuack's parser. SQLQuack also uses + the Snowflake SQL of SQLGlot's test suite as case inputs, with the expected answers recorded from + Snowflake itself. -Both are MIT-licensed. Their licences and the exact files concerned are in -[`THIRD_PARTY_NOTICES`](https://github.com/sqlstack-io/sqlquack/blob/main/THIRD_PARTY_NOTICES). +The translation to DuckDB and the recorded evidence behind it are SQLQuack's own. +SQLQuack goes a different way from both projects on translation. It doesn't rewrite the tree and +print it out. It checks each rule against recorded warehouse results and refuses what it can't +prove. + +Both are MIT licensed. Their licence texts and the exact files concerned are in +[`THIRD_PARTY_NOTICES`](https://github.com/sqlstack-io/sqlquack/blob/main/THIRD_PARTY_NOTICES), +which ships with every release.