betodealmeida commented on code in PR #35553:
URL: https://github.com/apache/superset/pull/35553#discussion_r2496319814


##########
superset/connectors/sqla/models.py:
##########
@@ -1502,8 +1502,18 @@ def adhoc_column_to_sqla(  # pylint: 
disable=too-many-locals
         """
         label = utils.get_column_name(col)
         try:
+            sql_expression = col["sqlExpression"]
+
+            # For column references, conditionally quote identifiers that need 
it
+            if col.get("isColumnReference"):
+                # Check if already quoted to avoid double-quoting
+                if not (
+                    sql_expression.startswith('"') and 
sql_expression.endswith('"')
+                ):

Review Comment:
   Unfortunately this won't work, because not all databases use `"` for quoting 
identifiers; some use backticks (MySQL), some use brackets (SQL Server).
   
   Why would this be quoted in the first place, can't we assume it's never 
quotes since it's selected from a dropdown? Or is this coming from somewhere 
else (adhoc input)?



##########
superset/connectors/sqla/models.py:
##########
@@ -1502,8 +1502,18 @@ def adhoc_column_to_sqla(  # pylint: 
disable=too-many-locals
         """
         label = utils.get_column_name(col)
         try:
+            sql_expression = col["sqlExpression"]
+
+            # For column references, conditionally quote identifiers that need 
it
+            if col.get("isColumnReference"):
+                # Check if already quoted to avoid double-quoting
+                if not (
+                    sql_expression.startswith('"') and 
sql_expression.endswith('"')
+                ):

Review Comment:
   Unfortunately this won't work, because not all databases use `"` for quoting 
identifiers; some use backticks (MySQL), some use brackets (SQL Server).
   
   Why would this be quoted in the first place, can't we assume it's never 
quoted since it's selected from a dropdown? Or is this coming from somewhere 
else (adhoc input)?



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