dbt-labs / dbt-core

dbt enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications.
https://getdbt.com
Apache License 2.0
9.68k stars 1.61k forks source link

add empty to context flags #10315

Closed MichelleArk closed 3 months ago

MichelleArk commented 3 months ago

resolves https://github.com/dbt-labs/dbt-core/issues/10317 resolves https://github.com/dbt-labs/dbt-core/issues/10152

Problem

We are missing the --empty flag value from the jinja context flags, making it tricky to overwrite the ref macro in a way that incorporates the value of --empty

Solution

Add empty to jinja flags + unit test

Checklist

🎩 (adding {{ log(flags.EMPTY, info=True) }} to locations.sql)

❯ dbt run --empty  --select locations
...
14:42:08  1 of 1 START sql view model test_arky.locations ................................ [RUN]
14:42:08  True
❯ dbt run --select locations
...
14:42:08  1 of 1 START sql view model test_arky.locations ................................ [RUN]
14:42:08  False
github-actions[bot] commented 3 months ago

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 88.71%. Comparing base (27b2f96) to head (ace8aca).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #10315 +/- ## ========================================== - Coverage 88.76% 88.71% -0.05% ========================================== Files 180 180 Lines 22488 22488 ========================================== - Hits 19962 19951 -11 - Misses 2526 2537 +11 ``` | [Flag](https://app.codecov.io/gh/dbt-labs/dbt-core/pull/10315/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dbt-labs) | Coverage Δ | | |---|---|---| | [integration](https://app.codecov.io/gh/dbt-labs/dbt-core/pull/10315/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dbt-labs) | `85.97% <ø> (-0.13%)` | :arrow_down: | | [unit](https://app.codecov.io/gh/dbt-labs/dbt-core/pull/10315/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dbt-labs) | `61.84% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dbt-labs#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.