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


##########
tests/unit_tests/jinja_context_test.py:
##########
@@ -507,6 +507,29 @@ def test_where_in() -> None:
     assert where_in(["O'Malley's"]) == "('O''Malley''s')"
 
 
+def test_where_in_bigquery_apostrophe() -> None:
+    """
+    Test that BigQuery dialect uses backslash escaping for apostrophes
+    instead of double-apostrophe escaping, which causes syntax errors.
+
+    See: https://github.com/apache/superset/issues/35857
+    """
+    try:
+        from sqlalchemy_bigquery import BigQueryDialect

Review Comment:
   This test is non-deterministic: the BigQuery dialect monkeypatch is applied 
when `superset/db_engine_specs/bigquery.py` is imported, but this test only 
imports `sqlalchemy_bigquery.BigQueryDialect`. If the BigQuery engine spec 
module hasn’t been imported earlier in the test run, 
`WhereInMacro(BigQueryDialect())` will still use the unpatched `colspecs` and 
this assertion will fail. Import the Superset BigQuery engine spec (or call the 
patch helper) in the test before instantiating `BigQueryDialect` so the test 
doesn’t depend on global import order.
   ```suggestion
           from sqlalchemy_bigquery import BigQueryDialect
           # Import the Superset BigQuery engine spec so its dialect 
monkeypatch is applied
           from superset.db_engine_specs import bigquery as 
_bigquery_engine_spec  # noqa: F401
   ```



##########
superset/db_engine_specs/bigquery.py:
##########
@@ -22,6 +22,7 @@
 import urllib
 from datetime import datetime
 from re import Pattern
+from collections.abc import Callable

Review Comment:
   Import ordering: `from collections.abc import Callable` is inserted after 
`from datetime import datetime`/`from re import Pattern`, which is likely to 
fail the repo’s import-sorting lint (ruff/isort). Reorder the stdlib `from ... 
import ...` lines so they’re sorted consistently.
   ```suggestion
   from collections.abc import Callable
   from datetime import datetime
   from re import Pattern
   ```



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