Hi, I'm using sqlparse 0.1.18 with Python 2.7 to split up some gigantic and unwieldy Oracle SQL scripts, for which it's truly a lifesaver.
I'm running into a puzzling issue where some fairly simple SQL statements can't be parsed correctly.
This is a condensed example which I've isolated from a larger procedure:
parser=sqlparse.parse(r'''
-- Works if comment is removed, or if line starting with INTO is removed
SELECT ss - (es - ss), ss, sw - 9, sw
INTO vsls, vels, vslw, velw
FROM i.cs s
WHERE cd >= ss and cd < es;''')
=>
~/.local/lib/python2.7/site-packages/sqlparse/sql.pyc in group_tokens(self, grp_cls, tokens, ignore_ws)
373 def group_tokens(self, grp_cls, tokens, ignore_ws=False):
374 """Replace tokens by an instance of *grp_cls*."""
--> 375 idx = self.token_index(tokens[0])
376 if ignore_ws:
377 while tokens and tokens[-1].is_whitespace():
Hi, I'm using
sqlparse0.1.18 with Python 2.7 to split up some gigantic and unwieldy Oracle SQL scripts, for which it's truly a lifesaver.I'm running into a puzzling issue where some fairly simple SQL statements can't be parsed correctly.
This is a condensed example which I've isolated from a larger procedure: