add exposures in load_assets_from_dbt_manifest #10395
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary & Motivation
load_assets_from_dbt_manifest
fails to load dbt assets when the providedmanifest.json
is from a dbt project that uses exposures.When
load_assets_from_dbt_manifest
is used to select nodes from dbt, exposures are not added in theManifest
. Indagster_dbt.asset_defs
here, only nodes, sources and metrics are selected and then passed to dbt core's selector here. The thing is that the selector function's _is_graph_member, defined as:expects the manifest to have exposures, otherwise, it will try to find the exposure keys from the nodes in
node = self.manifest.nodes[unique_id]
, which of course will lead to a keyError, like I got in my project:This adds a simple fix by defining the exposures to the
Manifest
How I Tested These Changes
The keyError disappeared after I added this change to my project. Also I have run
make isort
andmake black