fix(firebolt): allow backslach escape for single quotes (#32350)

This commit is contained in:
Beto Dealmeida
2025-02-24 11:12:34 -05:00
committed by GitHub
parent ace8a3adb7
commit 22fe985cfc
2 changed files with 25 additions and 1 deletions

View File

@@ -1164,3 +1164,24 @@ def test_firebolt_old() -> None:
*
FROM t1 UNNEST(col1 AS foo)"""
)
def test_firebolt_old_escape_string() -> None:
"""
Test the dialect for the old Firebolt syntax.
"""
from superset.sql.dialects import FireboltOld
from superset.sql.parse import SQLGLOT_DIALECTS
SQLGLOT_DIALECTS["firebolt"] = FireboltOld
# both '' and \' are valid escape sequences
sql = r"SELECT 'foo''bar', 'foo\'bar'"
# but they normalize to ''
assert (
SQLStatement(sql, "firebolt").format()
== """SELECT
'foo''bar',
'foo''bar'"""
)