We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0ff075c commit 332ea32Copy full SHA for 332ea32
sqlmesh/core/engine_adapter/fabric.py
@@ -303,7 +303,14 @@ def create_view(
303
qualified_view_name = self._fully_qualify(view_name)
304
305
if isinstance(query_or_df, exp.Expression):
306
+ # CTEs should not be qualified with the database name.
307
+ cte_names = {cte.alias_or_name for cte in query_or_df.find_all(exp.CTE)}
308
+
309
for table in query_or_df.find_all(exp.Table):
310
+ if table.this.name in cte_names:
311
+ continue
312
313
+ # Qualify all other tables that don't already have a catalog.
314
if not table.catalog:
315
qualified_table = self._fully_qualify(table)
316
table.replace(qualified_table)
0 commit comments