Extracting sql identifiers with sqlparse

191 views
Skip to first unread message

Michael Renner

unread,
Jan 21, 2014, 10:30:51 AM1/21/14
to sqlp...@googlegroups.com
Hi,

I'm trying to extract all SQL identifiers (table and column references) from a given statement including the context of the references (SELECT, WHERE, GROUP, ORDER, etc.) but wasn't overly successful with sqlparse.

Here's the script I hacked together: https://gist.github.com/terrorobe/8542101 and the output it produces: https://gist.github.com/terrorobe/8542065

This has been tested against eebde5b6a80ec34089acd8f7422f0a621918e6f5 of sqlparse (16th Jan).

Am I holding sqlparse wrong or is reliable identifier extraction something which isn't feasible in it's current state?

best,
Michael
Reply all
Reply to author
Forward
0 new messages