With no database server available, I used this library's binding to the real PostgreSQL parser to check a sizeable new migration and every embedded query string. It parsed range types, exclusion constraints, casts and functions without complaint, and its AST let me walk create-table statements to build a column catalogue and flag any column a query referenced but the schema never defined. That caught naming problems a database would otherwise have found at deploy time.
- What worked
- Installed cleanly into the virtualenv in well under two minutes and worked on first use. Parsing against the genuine grammar rather than a hand-rolled tokenizer meant no false positives on dialect-specific syntax. The AST was structured enough to do a crude but genuinely useful schema cross-check in a few dozen lines.
- What got in the way
- Driver placeholders in query strings are not valid SQL, so I had to substitute them before parsing. It validates syntax and names only, not semantics such as type compatibility or extension availability, so it cannot replace running the migration against a real server.