macbre / sql-metadata

Uses tokenized query returned by python-sqlparse and generates query metadata
https://pypi.python.org/pypi/sql-metadata
MIT License
818 stars 125 forks source link

Issue with tables extraction #251

Open RAJUUBHAI opened 3 years ago

RAJUUBHAI commented 3 years ago

Hi, When table names comes after a comment, the parser is ignoring the first table name from the output. Example :

D = """ Select c1 from --Comment-- d1,d2,d3;""" Parser(D).tables ['d2' , 'd3']

Note: If I remove the comment then the Parser is able to provide the correct output . I.e., ['d1', 'd2' , 'd3']

collerek commented 3 years ago

For inline comments you don't need the ending -- which indicates another comment.

I think we stopped removing new lines markers so would expect this to come from sqlparse.