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

Fix issues with inline nodes and selectors #10264

Merged
merged 8 commits into from
Jun 6, 2024
Merged

Conversation

gshank
Copy link
Contributor

@gshank gshank commented Jun 5, 2024

resolves #8943
resolves #9269

Problem

The inline node wasn't executing because of interactions with selection mechanisms.

Solution

We shouldn't use selectors at all when inline nodes are running. Add code in "get_selector" to make an exception for inline nodes. Add error message for using --select or --selector with --inline. Add hack to move inline node out of disabled if someone has disabled all model nodes in their project.

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/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

@gshank gshank requested a review from a team as a code owner June 5, 2024 15:21
@cla-bot cla-bot bot added the cla:yes label Jun 5, 2024
Copy link

codecov bot commented Jun 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.67%. Comparing base (a34267f) to head (ac20bde).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10264      +/-   ##
==========================================
- Coverage   88.72%   88.67%   -0.05%     
==========================================
  Files         180      180              
  Lines       22463    22482      +19     
==========================================
+ Hits        19931    19937       +6     
- Misses       2532     2545      +13     
Flag Coverage Δ
integration 85.93% <100.00%> (-0.18%) ⬇️
unit 63.24% <36.36%> (-0.05%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -104,6 +104,12 @@ def _runtime_initialize(self):
)
sql_node = block_parser.parse_remote(self.args.inline, "inline_query")
process_node(self.config, self.manifest, sql_node)
# Special hack to remove disabled, if it's there. This would only happen
# if all models are disabled in dbt_project
Copy link
Contributor

@MichelleArk MichelleArk Jun 6, 2024

Choose a reason for hiding this comment

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

So if all models are disabled, we effectively re-enable all of them? I think I'm missing something here as to why this would be safe to do, and how we know at this point that all models have been disabled

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only way that an inline node would be disabled is if somebody has all models to enabled: false (like in the test case) because there's no place else for enabled: false to come from. This just enables and moves the temporary inline node that was just created. It doesn't affect anything else in the manifest.

core/dbt/cli/flags.py Outdated Show resolved Hide resolved
@gshank gshank requested a review from MichelleArk June 6, 2024 18:44
@gshank gshank merged commit a980599 into main Jun 6, 2024
63 checks passed
@gshank gshank deleted the inline_default_selector branch June 6, 2024 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants