fix(sql): quote identifiers in transpile_to_dialect to fix case-sensitive column filters (#39521)

This commit is contained in:
Alexandru Soare
2026-05-06 10:53:09 +03:00
committed by GitHub
parent d7663a9a1c
commit adfbbf1433
3 changed files with 137 additions and 3 deletions

View File

@@ -1568,6 +1568,7 @@ def transpile_to_dialect(
sql: str,
target_engine: str,
source_engine: str | None = None,
identify: bool = False,
) -> str:
"""
Transpile SQL from one database dialect to another using SQLGlot.
@@ -1576,6 +1577,7 @@ def transpile_to_dialect(
sql: The SQL query to transpile
target_engine: The target database engine (e.g., "mysql", "postgresql")
source_engine: The source database engine. If None, uses generic SQL dialect.
identify: If True, quote all identifiers per the target dialect.
Returns:
The transpiled SQL string
@@ -1598,6 +1600,7 @@ def transpile_to_dialect(
copy=True,
comments=False,
pretty=False,
identify=identify,
)
except ParseError as ex:
raise QueryClauseValidationException(f"Cannot parse SQL clause: {sql}") from ex