Parsing SQL into a hierachial result to analyze it : <p>Is there any library (prefferably in Python) which can parse SQL queries (the PostgreSQL kind), and give me a structured representation of them? There is <a href="https://github.com/andialbrecht/sqlparse" rel="nofollow">sqlparse</a>, but that doesn't allow me to easily figure out (say) the table that a query is using. I only need support for <code>SELECT</code> queries, but some of them can be quite complex.</p>
