4 ms·
I find the support of plain SQL over the Postgres wire protocol (intended for BI usecases) really interesting. The article mentions a "SQL-to-SQL" compiler --
by gavinray 3y ago
I find the support of plain SQL over the Postgres wire protocol (intended for BI usecases) really interesting.
The article mentions a "SQL-to-SQL" compiler -- how exactly does this work?
Are you intercepting plain SQL queries over the wire, analyzing them, and then rewriting them into the form of queries that EdgeDB internally generates?
- RedCrowbar 3y agoYes, although rewrites are fairly minimal. Mostly limited to name mangling.
- gavinray 3y agoThat's really cool. Any chance you'd be able to link the relevant parts of the code? I had a look through the "/pg" directory but there was a lot there and it wasn't immediately clear which parts did what
- RedCrowbar 3y agoThe whole thing consists of these main parts: 1. SQL parser: https://github.com/edgedb/edgedb/tree/master/edb/pgsql/parser https://github.com/edgedb/edgedb/tree/master/edb/pgsql/parse... 2. SQL transpiler: https://github.com/edgedb/edgedb/tree/master/edb/pgsql/parser https://github.com/edgedb/edgedb/tree/master/edb/pgsql/parse... 3. Wire protocol handler: https://github.com/edgedb/edgedb/blob/master/edb/server/protocol/pg_ext.pyx https://github.com/edgedb/edgedb/blob/master/edb/server/prot...
- gavinray 3y agoThank you!
- aerzen 3y agoThis is the beef of that compiler: https://github.com/edgedb/edgedb/tree/master/edb%2Fpgsql%2Fresolver https://github.com/edgedb/edgedb/tree/master/edb%2Fpgsql%2Fr...