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

remove manifest from adapter.set_relations_cache signature #9213

Conversation

MichelleArk
Copy link
Contributor

@MichelleArk MichelleArk commented Dec 5, 2023

resolves #9217

Problem

Setting the relations cache requires an entire manifest currently, even though just a sliver of functionality is necessary for the task.

Solution

Pre-compute the manifest nodes to populate the cache for - passing in an iterable of RelationConfigs to the adapter instead of the entire manifest.

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

@cla-bot cla-bot bot added the cla:yes label Dec 5, 2023
Copy link
Contributor

github-actions bot commented Dec 5, 2023

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 Dec 5, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (ba53f05) 86.56% compared to head (03229d6) 86.61%.

Files Patch % Lines
core/dbt/task/runnable.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@                        Coverage Diff                        @@
##           relation-create-from-refactor    #9213      +/-   ##
=================================================================
+ Coverage                          86.56%   86.61%   +0.05%     
=================================================================
  Files                                215      215              
  Lines                              26862    26866       +4     
=================================================================
+ Hits                               23252    23271      +19     
+ Misses                              3610     3595      -15     
Flag Coverage Δ
integration 83.54% <88.88%> (+0.12%) ⬆️
unit 65.18% <22.22%> (-0.01%) ⬇️

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.

@MichelleArk MichelleArk marked this pull request as ready for review December 5, 2023 15:00
@MichelleArk MichelleArk requested review from a team as code owners December 5, 2023 15:00
@@ -406,11 +406,21 @@ def populate_adapter_cache(
if not self.args.populate_cache:
return

if self.manifest is None:
raise DbtInternalError("manifest was None in populate_adapter_cache")
Copy link
Contributor

Choose a reason for hiding this comment

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

Any idea under what conditions we wouldn't have a manifest?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was primarily added out of defensiveness & mypy appeasement , and is not an real expected condition -- it would be our own improper usage of populate_adapter_cache. Since GraphRunnableTask inherits from ConfiguredTask which has an optional manifest, mypy was flagging the None-value of manifest as potentially problematic. the manifest gets set earlier on during GraphRunnableTask execution and should not be None by this point.

node
for node in self.manifest.nodes.values()
if (node.is_relational and not node.is_ephemeral_model and not node.is_external_node)
]
Copy link
Contributor

Choose a reason for hiding this comment

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

any advantage to having this be a method or just a calculated attribute of the manifest itself?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

discussed sync: there isn't a great place for this logic -- the manifest shouldn't really need to know about the 'cacheable' concept, and it's only used in a single place. Leaving as-is for simplicity for the time being.

Base automatically changed from relation-create-from-refactor to feature/decouple-adapters-from-core December 6, 2023 18:46
@MichelleArk
Copy link
Contributor Author

closing in favor of: #9242

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.

3 participants