-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Unskip and rename test_expression_metric #8578
Merged
QMalcolm
merged 16 commits into
main
from
qmalcolm--8134-unskip-and-rename-test-expression-metric
Sep 7, 2023
Merged
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
1ac2f04
Add docstrings to `contracts/graph/metrics.py` functions to document …
QMalcolm b84b575
Add typing to `reverse_dag_parsing` and update function to work on 1.…
QMalcolm a92e5aa
Add typing to `parent_metrics` and `parent_metrics_names`
QMalcolm c8389f9
Add typing to `base_metric_dependency` and `derived_metric_dependency…
QMalcolm 8f0c5c6
Simplify implementations of `basic_metric_dependency` and `derived_me…
QMalcolm 4e062cb
Add typing to `ResolvedMetricReference` initialization
QMalcolm 4dfe539
Add typing to `derived_metric_dependency_graph`
QMalcolm 4a11c9f
Simplify conditional controls in `ResolvedMetricReference` functions
QMalcolm 41c8ad0
Don't recurse on over `depends_on` for non-derived metrics in `revers…
QMalcolm b476f28
Simplify `parent_metrics_names` by having it call `parent_metrics`
QMalcolm 84c5091
Unskip `TestMetricHelperFunctions.test_derived_metric` and update fix…
QMalcolm b073cff
Add changie doc for metric helper function updates
QMalcolm 711ca98
Get manifest in `test_derived_metric` from the parse dbt_run invocation
QMalcolm 70091df
Remove `Relation` a intiatlization attribute for `ResolvedMetricRefer…
QMalcolm da99e59
Add return typing to class `__` functions of `ResolvedMetricReference`
QMalcolm f80b4e1
Move from `manifest.metrics.get` to `manifest.expect` in metric helpers
QMalcolm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Fixes | ||
body: Update metric helper functions to work with new semantic layer metrics | ||
time: 2023-09-06T12:02:12.156534-07:00 | ||
custom: | ||
Author: QMalcolm | ||
Issue: "8134" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a valid scenario where it'd be valid for a unique_id to exist in
metric_node.depends_on.nodes
but not be inmanifest.metric
? If not, we could handle this less gracefully by getting metric frommetric = manifest.expect(parent_unique_id)
to ensure an issue is not silently handled.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
depends_on
contains metrics and things that aren't metrics (like semantic models). So if we were to usemanifest.expect(...)
we'd have to bring back checking if the returned node is a metric.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see! but once we've got what we know is a metric -- should we expect it to ever be
None
? If not, we could assert/raise an internal error here to make future investigation easierThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooo
expect
does a look up against all the manifest.x objects. I though this would be a bad runtime cost, but these are dictionaries not lists, so doing anin
lookup wouldn't be too costly. I'll switch to that as you suggested. That function handles theNone
case, and thus all we need to do on return is check if it's a metric node.