I will not open source it since it is a paid feature, but I use sqlglot for most of the query parsing, validating and rewriting.
reply