kenniy opened a new issue, #27957:
URL: https://github.com/apache/superset/issues/27957

   ### Bug description
   
   When creating a chart with a custom SQL column made up of a string 
containing more than one dot, such as `"google.co.uk"`, the chart fails to 
render with an "Unexpected error" message and PARSE_SYNTAX_ERROR details. 
   
   This issue occurs specifically when creating a chart using a dataset with 
Databricks connection. This is primarily needed to create table columns 
containing clickable links, i.e. `'<a 
href="https://google.com.uk";>google</a>'`, but the minimal example above 
demonstrates the error. 
   
   ### How to reproduce the bug
   
   1. Set up a Connection to Databricks SQL Warehouse in Superset
   2. Create a dataset using the Databricks connection
   3. Create a new Table chart using that dataset
   4. For a Dimension, select 'Custom SQL' and enter the string 
`"google.co.uk"` (including the double quotes)
   5. Click Update - the chart will fail to render
   
   ### Screenshots/recordings
   
   _No response_
   
   ### Superset version
   
   master / latest-dev
   
   ### Python version
   
   3.10
   
   ### Node version
   
   16
   
   ### Browser
   
   Firefox
   
   ### Additional context
   
   The same custom SQL with a multi-dot string works when:
   * Using other database connections. Tested with MySQL, Postgres, Presto
   * Executing the SQL directly in SQLLab with a Databricks connection (i.e. 
`select google.co.uk`)
   * See error from local environment below 
   ```
   2024-04-09 21:46:10,486:DEBUG:databricks.sql.thrift_backend:received thrift 
response: TCloseSessionResp(<REDACTED>)
   2024-04-09 21:46:10,492:WARNING:superset.connectors.sqla.models:Query SELECT 
co.uk" AS `My column` 
   FROM `examples`.`users` GROUP BY co.uk"
   LIMIT 1000 on schema examples failed
   Traceback (most recent call last):
     File "/app/superset/connectors/sqla/models.py", line 1795, in query
       df = self.database.get_df(sql, self.schema, mutator=assign_column_label)
     File "/app/superset/models/core.py", line 612, in get_df
       self.db_engine_spec.execute(cursor, sqls[-1])
     File "/app/superset/db_engine_specs/base.py", line 1596, in execute
       raise cls.get_dbapi_mapped_exception(ex) from ex
     File "/app/superset/db_engine_specs/base.py", line 1594, in execute
       cursor.execute(query)
     File "/usr/local/lib/python3.9/site-packages/databricks/sql/client.py", 
line 503, in execute
       execute_response = self.thrift_backend.execute_command(
     File 
"/usr/local/lib/python3.9/site-packages/databricks/sql/thrift_backend.py", line 
854, in execute_command
       return self._handle_execute_response(resp, cursor)
     File 
"/usr/local/lib/python3.9/site-packages/databricks/sql/thrift_backend.py", line 
947, in _handle_execute_response
       final_operation_state = self._wait_until_command_done(
     File 
"/usr/local/lib/python3.9/site-packages/databricks/sql/thrift_backend.py", line 
777, in _wait_until_command_done
       self._check_command_not_in_error_or_closed_state(
   �  File 
"/usr/local/lib/python3.9/site-packages/databricks/sql/thrift_backend.py", line 
579, in _check_command_not_in_error_or_closed_state
       raise ServerOperationError(
   databricks.sql.exc.ServerOperationError: 
   �[PARSE_SYNTAX_ERROR] Syntax error at or near '" AS `My column` \nFROM 
`examples`.`users` GROUP BY co.uk"'. SQLSTATE: 42601 (line 1, pos 12)
   
   == SQL ==
   SELECT co.uk" AS `My column` 
   ------------^^^
   FROM `examples`.`users` GROUP BY co.uk"
   LIMIT 1000
   ```
   
   ### Checklist
   
   - [X] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [X] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [X] I have checked Superset's logs for errors and if I found a relevant 
Python stacktrace, I included it here as text in the "additional context" 
section.


-- 
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: notifications-unsubscr...@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to