fix(Databricks): Escape catalog and schema names in pre-queries (#31199)

This commit is contained in:
Vitor Avila
2024-12-02 14:00:00 -03:00
committed by GitHub
parent 06fb330569
commit d66ac9f3f4
2 changed files with 20 additions and 4 deletions

View File

@@ -464,8 +464,10 @@ class DatabricksNativeEngineSpec(DatabricksDynamicBaseEngineSpec):
) -> list[str]:
prequeries = []
if catalog:
catalog = f"`{catalog}`" if not catalog.startswith("`") else catalog
prequeries.append(f"USE CATALOG {catalog}")
if schema:
schema = f"`{schema}`" if not schema.startswith("`") else schema
prequeries.append(f"USE SCHEMA {schema}")
return prequeries