diff --git a/dbt/include/global_project/macros/materializations/incremental/incremental.sql b/dbt/include/global_project/macros/materializations/incremental/incremental.sql index 71945f29f08..6bab2ee753b 100644 --- a/dbt/include/global_project/macros/materializations/incremental/incremental.sql +++ b/dbt/include/global_project/macros/materializations/incremental/incremental.sql @@ -60,10 +60,7 @@ {%- call statement() -%} {% set tmp_table_sql -%} - with dbt_incr_sbq as ( - {{ sql }} - ) - select * from dbt_incr_sbq + select * from ({{ sql }}) as dbt_incr_sbq where ({{ sql_where }}) or ({{ sql_where }}) is null {%- endset %}