oracle/dbt-oracle

[Bug] Append incremental strategy does not work due to typo

bjensen80 opened this issue · 3 comments

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Building an incremental model with append strategy fails with message:

Compilation Error in macro oracle__get_incremental_append_sql (macros/materializations/incremental/strategies.sql)
09:10:25    'args_dict' is undefined
09:10:25    
09:10:25    > in macro get_incremental_append_sql (macros/materializations/models/incremental/strategies.sql)
09:10:25    > called by macro materialization_incremental_oracle (macros/materializations/incremental/incremental.sql)
09:10:25    > called by macro oracle__get_incremental_append_sql (macros/materializations/incremental/strategies.sql)

Expected Behavior

I expect the model to build with the append-strategy.

There is a typo in strategies.sql

Relevant section:

{% macro oracle__get_incremental_append_sql(arg_dict) %}
    {%- set dest_columns = args_dict["dest_columns"] -%}
    {%- set temp_relation = args_dict["temp_relation"] -%}
    {%- set target_relation = args_dict["target_relation"] -%}
    {%- set dest_column_names = dest_columns | map(attribute='name') | list -%}
    {%- set dest_cols_csv = get_quoted_column_csv(model, dest_column_names)  -%}
    INSERT INTO {{ target_relation }} ({{ dest_cols_csv }})
    (
       SELECT {{ dest_cols_csv }}
       FROM {{ temp_relation }}
    )
{% endmacro %}

Replace arg_dict with args_dict (line 95 in source file).

Steps To Reproduce

  1. Create model with:
{{
    config(
        materialized='incremental',
        incremental_strategy = 'append'
    )
}}

--- Query

Relevant log output using --debug flag enabled

No response

Environment

- OS: Ubuntu 18.04
- Python: 3.10.7
- dbt: 1.3.1

What Oracle database version are you using dbt with?

11.2

Additional Context

No response

Thank you @bjensen80 for reporting this issue and the root cause

For now, as a work around, you can override the macro in your dbt project . Create a filemacros/incremental_append_strategy.sql in your project and add the macro contents.

In the next version of dbt-oracle we will fix this

@bjensen80

The first release cut v1.3.2rc1 is out. You can test the fix

pip install dbt-oracle==1.3.2rc1

Let me know you feedback

@bjensen80

The fix is included in latest released dbt-oracle==1.3.2