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


##########
tests/unit_tests/jinja_context_test.py:
##########
@@ -507,6 +507,27 @@ 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
+
+        where_in = WhereInMacro(BigQueryDialect())
+        result = where_in(["Armando's"])
+        # BigQuery requires backslash escaping, not double-apostrophe
+        assert "''" not in result, (
+            f"BigQuery should use backslash escaping, got double-apostrophe: 
{result}"
+        )
+        assert "\\'" in result or "Armando" in result

Review Comment:
   Good catch — fixed in 2e48b86. Removed the weak fallback and now strictly 
asserts backslash escaping is present.



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