This repository was archived by the owner on May 17, 2024. It is now read-only.
Commit 795bb0e
Sergey Vasilyev
Compile all AST elements always via dialects, never directly
The root authority on how to do the SQL syntax properly is the dialect — not the AST element itself. AST tree must only carry the intentions of what we want to execute, but not how it should/could be executed.
This makes the AST truly independent of dialects and databases, allowing us to:
- Focus on the main logic regardless of the SQL capabilities.
- Create custom database connectors without involving AST changes every time.
Before the change, adding a new database connector with unusual syntax would often require changing the AST elements to direct to `compiler.dialect.some_method()` — with only a subset of SQL being described in dialects. The other rather arbitrary part of SQL syntax was hard-coded in AST elements and could not be easily overridden without such changes.
After the change, all the SQL logic is concentrated in one hierarchy of dialects, mostly in one base class.1 parent b8cf482 commit 795bb0e
8 files changed
Lines changed: 475 additions & 377 deletions
File tree
- data_diff
- abcs
- databases
- queries
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
6 | | - | |
7 | | - | |
8 | | - | |
| 5 | + | |
9 | 6 | | |
10 | 7 | | |
11 | 8 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
176 | 177 | | |
177 | 178 | | |
178 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
179 | 184 | | |
180 | 185 | | |
181 | 186 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
| |||
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | 39 | | |
45 | 40 | | |
46 | 41 | | |
| |||
0 commit comments