Huh, weirdly enough I've been hoping for exactly this kind of thing - albeit easily called from Python.<p>My use-case is that with SQLite there are aspects of the table - things like generated columns - which aren't yet available via the regular SQLite PRAGMAs for introspecting tables.<p>For those things, the only way to introspect them is to read the CREATE TABLE statement out of the "sqlite_master" table and parse it.<p>But you need a very robust parser!<p>I've been investigating tree-sitter recently for this, notes here: <a href="https://til.simonwillison.net/python/tree-sitter" rel="nofollow noreferrer">https://til.simonwillison.net/python/tree-sitter</a><p>If anyone needs an implementation of that advanced ALTER TABLE mechanism (where you create a new table with the new schema, copy the data cross from the old one and then swap the names) my sqlite-utils CLI tool and Python library implements that, as described here: <a href="https://simonwillison.net/2020/Sep/23/sqlite-advanced-alter-table/" rel="nofollow noreferrer">https://simonwillison.net/2020/Sep/23/sqlite-advanced-alter-...</a>
don't you need a full parse even just for create and alter statements since you could always encounter an "as" followed by arbitrarily complex sql?