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
{% macro is_incremental() %}
{#-- do not run introspective queries in parsing #}
{% if not execute %}
{{ return(False) }}
Describe alternatives you've considered
I would like to test the following macro that uses 'is_incremental' and 'this' argument
{% macro get_table_max_id(where_clause = '', id_column = '"id"') %}
{% if is_incremental() %}
{% set max_id_query %}
select coalesce(max({{ id_column }}), 0) from {{ this }}
{{ where_clause }}
{% endset %}
{% set max_id_res = run_query(max_id_query) %}
{%endif%}
{{ return(max_id) }}
{% endmacro %}
following error:
def raise_compiler_error(msg, node=None) -> NoReturn:
raise CompilationException(msg, node)
E dbt.exceptions.CompilationException: Compilation Error in macro is_incremental (macros/materializations/models/incremental/is_incremental.sql)
E 'this' is undefined
E
E > in macro get_table_max_id (macros/unioner.sql)
E > called by macro test_table_max_id (macros/test_macro.sql)
E > called by macro is_incremental (macros/materializations/models/incremental/is_incremental.sql)
Who will this benefit?
All dbt users since is_incremental is very popular
Are you interested in contributing this feature?
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered:
Is this your first time opening an issue?
Describe the Feature
dbt adds the 'this' somehow in the is_incremental macro:
https://github.com/dbt-labs/dbt-core/blob/main/core/dbt/include/global_project/macros/materializations/models/incremental/is_incremental.sql
is_incremental.sql
{% macro is_incremental() %}
{#-- do not run introspective queries in parsing #}
{% if not execute %}
{{ return(False) }}
Describe alternatives you've considered
I would like to test the following macro that uses 'is_incremental' and 'this' argument
following error:
def raise_compiler_error(msg, node=None) -> NoReturn:
E dbt.exceptions.CompilationException: Compilation Error in macro is_incremental (macros/materializations/models/incremental/is_incremental.sql)
E 'this' is undefined
E
E > in macro get_table_max_id (macros/unioner.sql)
E > called by macro test_table_max_id (macros/test_macro.sql)
E > called by macro is_incremental (macros/materializations/models/incremental/is_incremental.sql)
Who will this benefit?
All dbt users since is_incremental is very popular
Are you interested in contributing this feature?
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: