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

Add flags from dbt_project.yml to the Project and RuntimeConfig objects #10644

Merged
merged 6 commits into from
Sep 6, 2024

Conversation

mikealfare
Copy link
Contributor

@mikealfare mikealfare commented Aug 29, 2024

Resolves #10618

Problem

We need to pass project flags from dbt_project.yml into the BaseAdapter instantiation to support behavior flags. Without this, users cannot override a behavior flag.

Solution

  • add flags as an attribute on Project, which then adds it to RuntimeConfig
  • pull the flags from dbt_project.yml::flags, not the global flags
    • the flags we're currently looking for are not expected to be overwritten by CLI args or environment variables
  • ensure existing tests pass
  • add tests that ensure RuntimeConfig contains arbitrary flags added in dbt_project.yml::flags

Checklist

  • I have read the contributing guide and understand what's expected of me.
  • I have run this code in development, and it appears to resolve the stated issue.
  • This PR includes tests, or tests are not required or relevant for this PR.
  • This PR has no interface changes (e.g., macros, CLI, logs, JSON artifacts, config files, adapter interface, etc.) or this PR has already received feedback and approval from Product or DX.
  • This PR includes type annotations for new and modified functions.

@mikealfare mikealfare self-assigned this Aug 29, 2024
@cla-bot cla-bot bot added the cla:yes label Aug 29, 2024
Copy link
Contributor

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.

Copy link

codecov bot commented Aug 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.91%. Comparing base (2218140) to head (cc628f2).
Report is 21 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10644      +/-   ##
==========================================
+ Coverage   88.86%   88.91%   +0.04%     
==========================================
  Files         180      180              
  Lines       22762    22799      +37     
==========================================
+ Hits        20228    20272      +44     
+ Misses       2534     2527       -7     
Flag Coverage Δ
integration 86.16% <100.00%> (+0.05%) ⬆️
unit 62.36% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Unit Tests 62.36% <100.00%> (+0.03%) ⬆️
Integration Tests 86.16% <100.00%> (+0.05%) ⬆️

@mikealfare mikealfare closed this Aug 29, 2024
@mikealfare mikealfare reopened this Aug 29, 2024
dev-requirements.txt Outdated Show resolved Hide resolved
@mikealfare mikealfare marked this pull request as ready for review September 4, 2024 23:51
@mikealfare mikealfare requested a review from a team as a code owner September 4, 2024 23:51
@mikealfare mikealfare merged commit 1d3d315 into main Sep 6, 2024
66 checks passed
@mikealfare mikealfare deleted the behavior-flags branch September 6, 2024 19:42
Copy link
Contributor

The backport to 1.8.latest failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-1.8.latest 1.8.latest
# Navigate to the new working tree
cd .worktrees/backport-1.8.latest
# Create a new branch
git switch --create backport-10644-to-1.8.latest
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 1d3d315249c81dbca70452e5a14fbfd0edad6b2a
# Push it to GitHub
git push --set-upstream origin backport-10644-to-1.8.latest
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-1.8.latest

Then, create a pull request where the base branch is 1.8.latest and the compare/head branch is backport-10644-to-1.8.latest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Behavior Flags] Add project flags to Project to be passed into BaseAdapter
3 participants