3 ms·
Parsing SQL can solve many problems, but before writing/choosing a parser you need to know what your goal is. For example, at work we wanted to have statically-
by rav 4y ago
Parsing SQL can solve many problems, but before writing/choosing a parser you need to know what your goal is. For example, at work we wanted to have statically-typed SQL statements in Python/mypy to statically identify syntax errors, misspelled column names and bad type mixes. We came up with a home-grown SQL parser [1] and type checker [2] in Rust and a mypy plugin [3]. If someone knows of other solutions for obtaining SQL/mypy integration I'd love to know about it, since parsing SQL is not exactly supposed to be our field of work.
[1] https://github.com/antialize/sql-parse/blob/7869595aa92aed0bb5a45b1a5716eca9af8f11d7/src/select.rs#L479 https://github.com/antialize/sql-parse/blob/7869595aa92aed0b...
[2] https://github.com/antialize/sql-type https://github.com/antialize/sql-type
[3] https://github.com/antialize/py-mysql-type-plugin https://github.com/antialize/py-mysql-type-plugin