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

parser.tables and parser.columns parses empty when encountering quoted identifiers [BUG]

Open LJHzju opened this issue 9 months ago • 0 comments

Table names or column names enclosed within single quotes ' are supported in sqlite, but it seems that sql-matedata cannot parse them. How to solve this problem?

For example:

sql = "SELECT r.Year, AVG(r.'Walt Disney Parks and Resorts') AS Avg_Parks_Revenue FROM 'revenue' r WHERE r.Year=2000;"

>>> parser = Parser(sql)
>>> parser.columns
['r.Year']

>>> parser.tables
[]

But this query can be executed in sqlite sucessfully.

LJHzju avatar Mar 19 '25 05:03 LJHzju