Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADAP-349] [Snowflake] Generate order-agnostic constraints ddl when contract: true #498

Closed
Tracked by #6747
MichelleArk opened this issue Mar 3, 2023 · 0 comments · Fixed by #521
Closed
Tracked by #6747
Assignees

Comments

@MichelleArk
Copy link
Contributor

Core issue: dbt-labs/dbt-core#7064

Wrap create_table_as user sql in schema-ordered select statement for models with contract: true

{% macro <adapter>__create_table_as(temporary, relation, sql) -%}
    ... 
    {% if config.get('contract', False) %}
      {{ get_assert_columns_equivalent(sql) }}
      {{ get_columns_spec_ddl() }}
      {%- set sql = get_select_subquery(sql) %}
    {% endif %}
  as (
    {{ sql }}
  );
{%- endmacro %}

We won't need to do this for view materializations as they don't support constraints.

@github-actions github-actions bot changed the title [Snowflake] Wrap create_table_as user sql in schema-ordered select statement for models with contract: true [ADAP-349] [Snowflake] Wrap create_table_as user sql in schema-ordered select statement for models with contract: true Mar 3, 2023
@MichelleArk MichelleArk changed the title [ADAP-349] [Snowflake] Wrap create_table_as user sql in schema-ordered select statement for models with contract: true [ADAP-349] [Snowflake] Generate order-agnostic constraints ddl when contract: true Mar 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants