We need a SQL parsing or decomposing library for Python. We would like to be able to input a SQL text query and then get the query parts back as a result. It doesn't need to be fancy, or anything, but we would like to avoid doing the parsing ourselves. Ideally, we could do something like:
the_query = "select something from some_table where blah = 'thing' limit 15"
query_parts = the_library.parse(the_query)
print query_parts.limit().val()
>>> '15'
And this, too:
the_query = "select something from some_table where blah = 'thing'"
query_parts = the_library.parse(the_query)
print query_parts.limit().val()
>>> None
Can anyone give us any pointers for this? If the functionality is more limited, that's OK as well.
Thanks a lot!