You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The general approach outlined in microsoft/dbt-synapse@9180da5 is still the same, though I was doing it on easy mode, and didn't actually try to solve for ephemeral model compilation :)
Taking a step back: In order to support ephemeral models with CTEs on SQLServer and Synapse, given that T-SQL doesn't support CTEs nested inside either CTEs or subqueries, would we have to take the same approach as the one outlined above?
Namely, instead of recursively prepending ephemeral models as CTEs to the start of the query:
with __dbt__cte__ephemeral_model as (
with my_cte as (
select1as id
)
select*from my_cte
),ephemeral_model as (
select*from __dbt__cte__ephemeral_model
),
another_cte as (
select2as id
)
select*from ephemeral_model
union allselect*from another_cte
Recursively prepend them as temp tables, to be executed in-transaction with the body of the query:
create table #ephemeral_model as (
with my_cte as (
select1as id
)
select*from my_cte
);
with ephemeral_model as (
select*from#ephemeral_model
),
another_cte as (
select2as id
)
select*from ephemeral_model
union allselect*from another_cte
The text was updated successfully, but these errors were encountered:
from #137, here's the proposed solution
The text was updated successfully, but these errors were encountered: