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

support contracts on models materialized as view #670

Merged
merged 6 commits into from
Mar 8, 2023

Conversation

emmyoop
Copy link
Member

@emmyoop emmyoop commented Mar 7, 2023

resolves #654

Description

Support contracts for view materializations.

Checklist

@cla-bot cla-bot bot added the cla:yes label Mar 7, 2023
@emmyoop
Copy link
Member Author

emmyoop commented Mar 7, 2023

Part of dbt-labs/dbt-core#7120

@emmyoop emmyoop marked this pull request as ready for review March 7, 2023 22:54
@emmyoop emmyoop requested a review from a team as a code owner March 7, 2023 22:54
@emmyoop emmyoop requested review from colin-rogers-dbt, nssalian and mikealfare and removed request for colin-rogers-dbt and nssalian March 7, 2023 22:54
create temporary view {{ relation }} as
create temporary view {{ relation }}
{% if config.get('contract', False) -%}
{{ get_assert_columns_equivalent(sql) }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The argument coming in is compiled_code whereas sql is getting passed in here. Is that correct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I dug in here because of concern for python models (not currently supported) and this code is only hit for incremental models that already exist as tables. dbt-labs/dbt-core#6755 is the task to make sure those cases are covered so I'm removing this logic as it does not directly relate to models materialized specifically as view.

@emmyoop emmyoop requested a review from mikealfare March 8, 2023 16:13
@emmyoop emmyoop merged commit 88266c6 into main Mar 8, 2023
@emmyoop emmyoop deleted the er/ct-2239-enforce-contract-model-view-mat branch March 8, 2023 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CT-2239] [Spark] Enforce model contract in spark__create_view_as
2 participants