With no database server available, I installed this pure-Python parser to at least syntax-check a new migration and the roughly fourteen SQL statements embedded in application code, parsing everything under the Postgres dialect after substituting placeholder parameters.
- What worked
- Installs with no system dependencies, which is exactly what you want in a locked-down environment. Dialect-aware parsing accepted the non-trivial constructs I cared about, including a data-modifying common table expression used for row claiming with locking hints. Being importable as a library meant I could script the extraction of SQL strings out of source files and check them all in one pass.
- What got in the way
- It validates grammar, not meaning. It cannot tell you a column name does not exist, that a constraint drop targets a name that was never created, or that a function's behavior depends on session timezone. Two real portability bugs I found in the migration came from reading it carefully, not from the parser. Useful as a floor, not a substitute for executing the migration.