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
I have searched the existing issues, and I could not find an existing issue for this bug
Current Behavior
I have created a custom materialization which is modifying the compiled_code and removing columns for final output, then passing the modified code to create_table_as. This is erroring on the fields removed in the contracts.
{% macro snowflake__create_table_as(temporary, relation, compiled_code, language='sql') -%}
is enforcing the contract on a variable "sql", which is not defined instead of passed variable named "compiled_code". {{ get_assert_columns_equivalent(sql) }}
should be {{ get_assert_columns_equivalent(compiled_code) }}
Expected Behavior
Contracts should be enforced on the code passed to the create_table_as() macro.
Steps To Reproduce
Create a custom materialization which modifies the compiled_code.
Create a contract on the table, excluding the columns which are listed in "exclude_columns".
Run materialization
Relevant log output
This model has an enforced contract that failed.
Please ensure the name, data_type, and number of columns in your contract match the columns in your model's definition. | column_name | definition_type | contract_type | mismatch_reason | | ----------------- | --------------- | ------------- | ------------------- | | METADATA$ACTION | TEXT | | missing in contract | | METADATA$ISUPDATE | BOOLEAN | | missing in contract |
I should say, I have already overridden the code with my own version and fixed my current issue by changing the "compiled_code" variable to "sql", the same as other instances of the code.
{% macro snowflake__create_table_as(temporary, relation, sql, language='sql') -%}
...
(
{%- if cluster_by_string is not none -%}
select * from (
{{ sql }}
) order by ({{ cluster_by_string }})
{%- else -%}
{{ sql }}
{%- endif %}
);
...
{{ py_write_table(compiled_code=sql, target_relation=relation, table_type=table_type) }}
Is this a new bug in dbt-snowflake?
Current Behavior
I have created a custom materialization which is modifying the compiled_code and removing columns for final output, then passing the modified code to create_table_as. This is erroring on the fields removed in the contracts.
{% macro snowflake__create_table_as(temporary, relation, compiled_code, language='sql') -%}
is enforcing the contract on a variable "sql", which is not defined instead of passed variable named "compiled_code".
{{ get_assert_columns_equivalent(sql) }}
should be
{{ get_assert_columns_equivalent(compiled_code) }}
Expected Behavior
Contracts should be enforced on the code passed to the create_table_as() macro.
Steps To Reproduce
Create a custom materialization which modifies the compiled_code.
Create a contract on the table, excluding the columns which are listed in "exclude_columns".
Run materialization
Relevant log output
Environment
Additional Context
No response
The text was updated successfully, but these errors were encountered: