bobelev commented on issue #27294:
URL: https://github.com/apache/superset/issues/27294#issuecomment-2045343082

   Same here
   
   We use clickhouse and it has strange (but valid) queries that sometimes are 
not normally parsed by SQL parsers.
   
   Can't apply `new_dataset_models_take_2` migration
   
   ```
     File "/usr/local/lib/python3.9/site-packages/sqlglot/__init__.py", line 
87, in parse
       return Dialect.get_or_raise(read or dialect).parse(sql, **opts)
     File "/usr/local/lib/python3.9/site-packages/sqlglot/dialects/dialect.py", 
line 490, in parse
       return self.parser(**opts).parse(self.tokenize(sql), sql)
     File "/usr/local/lib/python3.9/site-packages/sqlglot/parser.py", line 
1153, in parse
       return self._parse(
     File "/usr/local/lib/python3.9/site-packages/sqlglot/parser.py", line 
1222, in _parse
       self.raise_error("Invalid expression / Unexpected token")
     File "/usr/local/lib/python3.9/site-packages/sqlglot/parser.py", line 
1263, in raise_error
       raise error
   sqlglot.errors.ParseError: Invalid expression / Unexpected token. Line 6, 
Col: 30.
   
   
   The above exception was the direct cause of the following exception:
   
   
     File 
"/usr/local/lib/python3.9/site-packages/alembic/runtime/migration.py", line 
561, in run_migrations
       step.migration_fn(**kw)
     File 
"/app/superset/migrations/versions/2022-04-01_14-38_a9422eeaae74_new_dataset_models_take_2.py",
 line 895, in upgrade
       postprocess_datasets(session)
     File 
"/app/superset/migrations/versions/2022-04-01_14-38_a9422eeaae74_new_dataset_models_take_2.py",
 line 594, in postprocess_datasets
       table_refrences = extract_table_references(
     File "/app/superset/sql_parse.py", line 1037, in extract_table_references
       return parsed.tables
     File "/app/superset/sql_parse.py", line 287, in tables
       self._tables = self._extract_tables_from_sql()
     File "/app/superset/sql_parse.py", line 301, in _extract_tables_from_sql
       raise SupersetSecurityException(
   superset.exceptions.SupersetSecurityException: Unable to parse SQL 
(generic): SELECT ts,
   …redacted…
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to