mosaic icon indicating copy to clipboard operation
mosaic copied to clipboard

Query Parsing and Analysis

Open domoritz opened this issue 1 year ago • 3 comments

Currently query analysis is only possible when using Mosaic’s SQL builder methods, which maintain a structured representation of the query. While arbitrary query expressions are allowed, they are not analyzed. This project would develop a SQL parser in JavaScript that we can use to parse SQL text into a structured representation such as an AST. DuckDB already has a parser in the JSON extension.

domoritz avatar May 23 '24 14:05 domoritz

This could be super useful for #510 but we probably want to consider revising the SQL representation in mosaic first.

domoritz avatar Sep 01 '24 16:09 domoritz

Depending on how wide you're looking to go with multi database support beyond the DuckDB multi database support for Postgres/MySQL, could use something like this. Seems like lots of dialects are implemented; I'm sure DuckDB isn't too far from Postgres. Not too sure of quality, but seems reasonable?

nicosuave avatar Sep 08 '24 21:09 nicosuave

Thanks for the link. I think we can make our lives a bit easier by generating SQL in different dialects from a structured format (which we already have in https://github.com/uwdata/mosaic/tree/main/packages/sql). But we need to make the current implementation more flexible.

domoritz avatar Sep 13 '24 18:09 domoritz