Copilot commented on code in PR #37890:
URL: https://github.com/apache/superset/pull/37890#discussion_r2979465645


##########
superset/db_engine_specs/kusto.py:
##########
@@ -213,3 +265,31 @@ def convert_dttm(
             return f"""datetime({dttm.isoformat(timespec="microseconds")})"""
 
         return None
+
+    @classmethod
+    def execute(
+        cls,
+        cursor: Any,
+        query: str,
+        database: "Database",
+        **kwargs: Any,
+    ) -> None:
+        """
+        Execute a KQL query, fixing ARRAY() wrappers around
+        bracket-quoted identifiers.
+
+        Example:
+            ARRAY(["age"]) -> ["age"]
+            ARRAY(["user_name"]) -> ["user_name"]
+        """
+        logger.debug("execute: input query: %s", query)
+
+        # Replace ARRAY(["identifier"]) with ["identifier"]
+        processed_query = re.sub(
+            r'ARRAY\(\[("(?:[^"\\]|\\.)*")\]\)',
+            r"[\1]",
+            query,
+        )
+
+        logger.debug("execute: processed query: %s", processed_query)
+        super().execute(cursor, processed_query, database, **kwargs)

Review Comment:
   The new debug logs print full raw/processed query strings. Queries can 
include sensitive literals (emails, tokens, customer identifiers) and can be 
large, so logging them can create data-exposure and log-volume risks when debug 
logging is enabled. Consider removing these logs, or logging only a 
boolean/metric (e.g., whether a rewrite occurred / number of replacements) 
and/or a safely-truncated/redacted version of the query.



##########
superset/db_engine_specs/kusto.py:
##########
@@ -28,8 +29,13 @@
     SupersetDBAPIOperationalError,
     SupersetDBAPIProgrammingError,
 )
+
+if TYPE_CHECKING:
+    from superset.models.core import Database

Review Comment:
   Import grouping: the `if TYPE_CHECKING:` block is immediately followed by a 
non-conditional import (`from superset.sql.parse import LimitMethod`) without a 
separating blank line. This is atypical in this codebase (and may trip 
isort/ruff import formatting) because it visually reads as though the next 
import is part of the TYPE_CHECKING block. Add a blank line after the 
TYPE_CHECKING block (or reorder imports per isort).
   ```suggestion
       from superset.models.core import Database
   ```



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