Holy smokes, this is super impressive!
I have a personal question if you don't mind -- I do some SQL query generation and transpilation for both work and hobby. One headache I've run into recently is generating nested EXISTS() subqueries.
Imagine you have something like this:
// WHERE Name = 'Audioslave'
{
type: "binary_op",
operator: "equal",
column: { path: [], name: "Name" },
value: { type: "scalar", value: "Audioslave" },
}
This is all fine, but what if you want to say "A binary operation on related entities": {
type: "binary_op",
operator: "equal",
column: { path: ["Albums", "Tracks"], name: "AlbumId" },
value: { type: "scalar", value: 40 },
},
Which you want to generate something like: WHERE EXISTS(SELECT 1 FROM Albums WHERE Albums.ForeignKey = t.PrimaryKey
AND EXISTS(SELECT 1 FROM Tracks WHERE Tracks.ForeignKey = Albums.PrimaryKey AND AlbumId = 40))
How to do this is giving me a headache for a lot of reasons and I can't seem to come up with a good way.
Any tips, references, or search terms to google?Thank you, look forward to digging in more + gave your repo a star!