sql-metadata icon indicating copy to clipboard operation
sql-metadata copied to clipboard

Issue with tables extraction

Open RAJUUBHAI opened this issue 3 years ago • 1 comments

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']

RAJUUBHAI avatar Oct 30 '21 10:10 RAJUUBHAI

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.

collerek avatar Oct 30 '21 10:10 collerek

Even if you just have -- in the inline comment, there is no change in the output. The output will be the same for /* comment */ as well.

RAJUUBHAI avatar Nov 01 '21 12:11 RAJUUBHAI