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

make full refresh a config item #2438

Merged
merged 2 commits into from
May 12, 2020

Conversation

beckjake
Copy link
Contributor

@beckjake beckjake commented May 12, 2020

resolves #1009

Description

This PR makes full refresh a config item (full_refresh) in addition to a flag --full-refresh/flags.FULL_REFRESH. The config item can be True, False, or None, and if it's True or False that overrides the flag.

I updated dbt's included materializations to check a new macro that examines both the model config and the flag.

Checklist

  • I have signed the CLA
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change to the "dbt next" section.

@cla-bot cla-bot bot added the cla:yes label May 12, 2020
@beckjake beckjake force-pushed the feature/full-refresh-config branch from bfd3fd8 to 13a66f5 Compare May 12, 2020 17:58
Added integration tests, fixed existing tests
@beckjake beckjake force-pushed the feature/full-refresh-config branch from 13a66f5 to 0fa9d0a Compare May 12, 2020 18:10
@beckjake beckjake requested a review from drewbanin May 12, 2020 18:19
Copy link
Contributor

@drewbanin drewbanin left a comment

Choose a reason for hiding this comment

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

One tiny comment about an arg that I don't think matters, but this otherwise LGTM!



{% macro should_full_refresh() %}
{% set config_full_refresh = config.get('full_refresh', false) %}
Copy link
Contributor

Choose a reason for hiding this comment

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

i think the second arg to config.get is the validator, right? Do we even want to supply that here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, I always forget it's not just a dict!

@@ -8,6 +8,6 @@
{{ return(relation is not none
and relation.type == 'table'
and model.config.materialized == 'incremental'
and not flags.FULL_REFRESH) }}
and not should_full_refresh()) }}
Copy link
Contributor

Choose a reason for hiding this comment

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

⭐ ⭐ ⭐

Copy link
Contributor

@drewbanin drewbanin left a comment

Choose a reason for hiding this comment

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

fyi #2441 :)

Ship it!

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.

Move --full-refresh into a model config
2 participants