171 karma · joined May 1, 2017
Trying out SQLMesh is easy, you can import your existing project and leverage SQLMesh's runtime. At the very least, you can add unit tests to your project.
You can see a more detailed comparison here https://sqlmesh.readthedocs.io/en/stable/comparisons/.
SELECT * FROM (SELECT * FROM x) WHERE z = 1
can be optimized into
SELECT * FROM x where z = 1
https://github.com/tobymao/saq
Looks like you use BLPOP, but there could be race conditions or lost jobs if your workers crash, check out BLMOVE and RPOPLPUSH.
Here's an example of how we use SQLGlot to output raw Python code directly from SQL.
https://github.com/tobymao/sqlglot/blob/main/sqlglot/executo...
In terms of versioning of engines, I haven't implemented that yet, but presumably it could be done by adding a dialect subclass and having versioning route to it, so we could do something like parse(sql, dialect="spark", version=...) which could then route to a 2.3 version of spark.
Happy to chat more about this and we can see about adding it (or feel free to make a pr). You can DM me on twitter or some other avenue as well if you want to dive in deep.
So if you run the optimizer first and then the diff tool, it could solve this kind of use case.
You can see what it took to add this in this commit.
https://github.com/tobymao/sqlglot/commit/ab49a3a2964bdff3a3...
https://github.com/tobymao/sqlglot/blob/main/tests/fixtures/... https://github.com/tobymao/sqlglot/blob/main/tests/fixtures/...
https://github.com/tobymao/sqlglot/blob/main/tests/fixtures/...
I can even parse and optimize TPC-H https://github.com/tobymao/sqlglot/blob/main/tests/fixtures/....
SQLGlot's parser handles a superset of SQL, so it's much more flexible than any one engine.
i'm not exactly sure what you're asking though, in terms of sql generation, it's not difficult for me because i just take in sql and output sql from the ast
Something that I'm working on is a pure python SQL engine https://github.com/tobymao/sqlglot/blob/main/sqlglot/executo.... It does the whole shebang, parsing, optimizations, logical planning, physical execution.