Skip to content

Commit 321f2a6

Browse files
committed
docs: credit Polyglot and SQLGlot for the parser SQLQuack forked
The README says where SQLQuack's parser comes from and adds a Credits section for Polyglot and SQLGlot. The credits page says the same. THIRD_PARTY_NOTICES now names the parser as a modified fork of polyglot, in sqlquack-syntax-snowflake, sqlquack-syntax and sqlquack-derive. It gives the current paths of the ported DuckDB result-type rules and their fixture, and lists the semantic checks ported from polyglot's validation. The licence texts are unchanged, and the distribution copies match the root.
1 parent e1a583e commit 321f2a6

5 files changed

Lines changed: 63 additions & 27 deletions

File tree

‎README.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ SQL that runs on two engines doesn't always return the same answer. NULLs, decim
2929

3030
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.
3131

32+
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.
33+
3234
- **Check early.** Catch invalid SQL before it reaches the warehouse.
3335
- **Test locally.** Convert queries to DuckDB SQL for tests against small fixtures.
3436
- **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
9395

9496
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.
9597

98+
## Credits
99+
100+
SQLQuack wouldn't exist without two projects:
101+
102+
- **[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.
103+
- **[SQLGlot](https://github.com/tobymao/sqlglot)** by Toby Mao and contributors. Polyglot is based on SQLGlot's design, and so is SQLQuack's parser.
104+
105+
Both are MIT licensed. Their licence texts are in [THIRD_PARTY_NOTICES](THIRD_PARTY_NOTICES) and ship with every release.
106+
107+
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.
108+
96109
---
97110

98111
Built in Rust. Free and open source. [Apache 2.0](https://github.com/sqlstack-io/sqlquack/blob/main/LICENSE).

‎THIRD_PARTY_NOTICES‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,19 @@ SOFTWARE.
5757
polyglot
5858
--------
5959

60-
Parts of SQLQuack's tokenizer and parser, in crates/sqlquack-syntax and
61-
crates/sqlquack-derive, are derived from polyglot (https://github.com/tobilg/polyglot),
62-
as forked at https://github.com/sqlstack-io/polyglot. The exact-check corpus
60+
SQLQuack's tokenizer, parser and syntax tree are a modified fork of polyglot
61+
(https://github.com/tobilg/polyglot), as forked at https://github.com/sqlstack-io/polyglot.
62+
The derived code is in crates/sqlquack-syntax-snowflake, which now holds most of it,
63+
crates/sqlquack-syntax and crates/sqlquack-derive. The exact-check corpus
6364
corpora/polyglot-check/polyglot_tests.json holds the SQL inputs of polyglot's tests.
64-
SQLQuack's DuckDB result-type rules, in crates/sqlquack-semantics/src/lineage/_helpers/duckdb_typing.rs
65-
and duckdb_types.rs, are ported from polyglot's engine type rules, and the fixture
66-
crates/sqlquack-semantics/src/lineage/tests/fixtures/duckdb_engine_types.json is polyglot's
65+
SQLQuack's DuckDB result-type rules, in crates/sqlquack-semantics/src/duckdb/profile/_helpers/typing.rs,
66+
are ported from polyglot's engine type rules, and the fixture
67+
crates/sqlquack-semantics/src/duckdb/profile/tests/fixtures/duckdb_engine_types.json is polyglot's
6768
tests/fixtures/engine_types/duckdb.json, the result types DuckDB bound for its synthetic cases.
69+
The semantic checks in crates/sqlquack-semantics/src/lineage/_helpers/checks are ported from
70+
polyglot's validation: the type families in families.rs, the built-in function signatures in
71+
signatures.rs and the scope rules in scope_rules.rs, and the type checks and their messages in
72+
node_checks.rs, relational.rs and sets.rs.
6873
The lint Rules' scope walk and aggregate classifier, in crates/sqlquack-lint/src/tree, are ported
6974
from polyglot's scope.rs and traversal.rs.
7075

‎crates/sqlquack/THIRD_PARTY_NOTICES‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,19 @@ SOFTWARE.
5757
polyglot
5858
--------
5959

60-
Parts of SQLQuack's tokenizer and parser, in crates/sqlquack-syntax and
61-
crates/sqlquack-derive, are derived from polyglot (https://github.com/tobilg/polyglot),
62-
as forked at https://github.com/sqlstack-io/polyglot. The exact-check corpus
60+
SQLQuack's tokenizer, parser and syntax tree are a modified fork of polyglot
61+
(https://github.com/tobilg/polyglot), as forked at https://github.com/sqlstack-io/polyglot.
62+
The derived code is in crates/sqlquack-syntax-snowflake, which now holds most of it,
63+
crates/sqlquack-syntax and crates/sqlquack-derive. The exact-check corpus
6364
corpora/polyglot-check/polyglot_tests.json holds the SQL inputs of polyglot's tests.
64-
SQLQuack's DuckDB result-type rules, in crates/sqlquack-semantics/src/lineage/_helpers/duckdb_typing.rs
65-
and duckdb_types.rs, are ported from polyglot's engine type rules, and the fixture
66-
crates/sqlquack-semantics/src/lineage/tests/fixtures/duckdb_engine_types.json is polyglot's
65+
SQLQuack's DuckDB result-type rules, in crates/sqlquack-semantics/src/duckdb/profile/_helpers/typing.rs,
66+
are ported from polyglot's engine type rules, and the fixture
67+
crates/sqlquack-semantics/src/duckdb/profile/tests/fixtures/duckdb_engine_types.json is polyglot's
6768
tests/fixtures/engine_types/duckdb.json, the result types DuckDB bound for its synthetic cases.
69+
The semantic checks in crates/sqlquack-semantics/src/lineage/_helpers/checks are ported from
70+
polyglot's validation: the type families in families.rs, the built-in function signatures in
71+
signatures.rs and the scope rules in scope_rules.rs, and the type checks and their messages in
72+
node_checks.rs, relational.rs and sets.rs.
6873
The lint Rules' scope walk and aggregate classifier, in crates/sqlquack-lint/src/tree, are ported
6974
from polyglot's scope.rs and traversal.rs.
7075

‎python/THIRD_PARTY_NOTICES‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,19 @@ SOFTWARE.
5757
polyglot
5858
--------
5959

60-
Parts of SQLQuack's tokenizer and parser, in crates/sqlquack-syntax and
61-
crates/sqlquack-derive, are derived from polyglot (https://github.com/tobilg/polyglot),
62-
as forked at https://github.com/sqlstack-io/polyglot. The exact-check corpus
60+
SQLQuack's tokenizer, parser and syntax tree are a modified fork of polyglot
61+
(https://github.com/tobilg/polyglot), as forked at https://github.com/sqlstack-io/polyglot.
62+
The derived code is in crates/sqlquack-syntax-snowflake, which now holds most of it,
63+
crates/sqlquack-syntax and crates/sqlquack-derive. The exact-check corpus
6364
corpora/polyglot-check/polyglot_tests.json holds the SQL inputs of polyglot's tests.
64-
SQLQuack's DuckDB result-type rules, in crates/sqlquack-semantics/src/lineage/_helpers/duckdb_typing.rs
65-
and duckdb_types.rs, are ported from polyglot's engine type rules, and the fixture
66-
crates/sqlquack-semantics/src/lineage/tests/fixtures/duckdb_engine_types.json is polyglot's
65+
SQLQuack's DuckDB result-type rules, in crates/sqlquack-semantics/src/duckdb/profile/_helpers/typing.rs,
66+
are ported from polyglot's engine type rules, and the fixture
67+
crates/sqlquack-semantics/src/duckdb/profile/tests/fixtures/duckdb_engine_types.json is polyglot's
6768
tests/fixtures/engine_types/duckdb.json, the result types DuckDB bound for its synthetic cases.
69+
The semantic checks in crates/sqlquack-semantics/src/lineage/_helpers/checks are ported from
70+
polyglot's validation: the type families in families.rs, the built-in function signatures in
71+
signatures.rs and the scope rules in scope_rules.rs, and the type checks and their messages in
72+
node_checks.rs, relational.rs and sets.rs.
6873
The lint Rules' scope walk and aggregate classifier, in crates/sqlquack-lint/src/tree, are ported
6974
from polyglot's scope.rs and traversal.rs.
7075

‎website/src/content/docs/docs/credits.mdx‎

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,22 @@ title: "Credits"
33
description: "The open-source projects SQLQuack builds on."
44
---
55

6-
SQLQuack's tokenizer and parser started from code derived from
7-
[Polyglot](https://github.com/tobilg/polyglot), by Tobias
8-
([@tobilg](https://github.com/tobilg)). Its DuckDB result-type rules are ported from Polyglot's
9-
engine type rules. Thank you, Tobias.
6+
SQLQuack wouldn't exist without two projects:
107

11-
Thanks also to [SQLGlot](https://github.com/tobymao/sqlglot), by Toby Mao. Polyglot is inspired by
12-
SQLGlot, and SQLQuack uses the Snowflake SQL of SQLGlot's test suite as case inputs, with the
13-
expected answers recorded from Snowflake itself.
8+
- **[Polyglot](https://github.com/tobilg/polyglot)** by Tobias
9+
([@tobilg](https://github.com/tobilg)). SQLQuack's tokenizer, parser and syntax tree are a
10+
modified fork of Polyglot's, and much of that code is still his. Its DuckDB result-type rules
11+
and its semantic checks are also ported from Polyglot.
12+
- **[SQLGlot](https://github.com/tobymao/sqlglot)** by Toby Mao and contributors. Polyglot is a
13+
Rust port of SQLGlot and is based on its design, and so is SQLQuack's parser. SQLQuack also uses
14+
the Snowflake SQL of SQLGlot's test suite as case inputs, with the expected answers recorded from
15+
Snowflake itself.
1416

15-
Both are MIT-licensed. Their licences and the exact files concerned are in
16-
[`THIRD_PARTY_NOTICES`](https://github.com/sqlstack-io/sqlquack/blob/main/THIRD_PARTY_NOTICES).
17+
The translation to DuckDB and the recorded evidence behind it are SQLQuack's own.
18+
SQLQuack goes a different way from both projects on translation. It doesn't rewrite the tree and
19+
print it out. It checks each rule against recorded warehouse results and refuses what it can't
20+
prove.
21+
22+
Both are MIT licensed. Their licence texts and the exact files concerned are in
23+
[`THIRD_PARTY_NOTICES`](https://github.com/sqlstack-io/sqlquack/blob/main/THIRD_PARTY_NOTICES),
24+
which ships with every release.

0 commit comments

Comments
 (0)