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

Support custom granularity in linkable spec resolution #1415

Merged
merged 4 commits into from
Sep 24, 2024

Conversation

courtneyholcomb
Copy link
Contributor

@courtneyholcomb courtneyholcomb commented Sep 20, 2024

Further updates to linkable spec resolution needed to support custom granularities.

This also fixes a bug related to cumulative metric restrictions: Cumulative metrics CAN be queried with non-default granularity now, so this removes that restriction. This was not an issue in actual queries because that logic was only hit when querying metadata, but it could result in a bug when listing dimensions for a cumulative metric. Instead of restricting derived time granularity, restrict cumulative metrics from being used with date part (this matches existing query behavior). This change required adding a DATE_PART LinkableElementProperty and updating LinkableDimensions accordingly, so that's what you'll see in the snapshot changes.

@cla-bot cla-bot bot added the cla:yes label Sep 20, 2024
@dbt-labs dbt-labs deleted a comment from github-actions bot Sep 20, 2024
@courtneyholcomb courtneyholcomb changed the title Check query tests for custom granularity Support custom granularity in linkable spec resolution Sep 20, 2024
@courtneyholcomb courtneyholcomb marked this pull request as ready for review September 20, 2024 22:20
@courtneyholcomb courtneyholcomb force-pushed the court/parse-custom-2 branch 2 times, most recently from 5751872 to d78a350 Compare September 24, 2024 17:22
@@ -27,6 +27,8 @@ class LinkableElementProperty(Enum):
METRIC_TIME = "metric_time"
# Refers to a metric, not a dimension.
METRIC = "metric"
# An time dimension with a DatePart.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I think you meant "A" not "An" here, right? (Or is this a convention I'm not aware of?)

Copy link
Contributor

@tlento tlento left a comment

Choose a reason for hiding this comment

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

LGTM! Please fix typo @theyostalservice noticed

Apropos of nothing but I need some amusement...

roy kent growling at some kid

Base automatically changed from court/parse-custom-2 to main September 24, 2024 22:14
…ution

Cumulative metrics CAN be queried with non-default granularity now, so
remove that restriction. This was not an issue in actual queries because
 that logic was only hit when querying metadata, but this old logic
could result in a bug when listing dimensions for a cumulative metric.
Instead, restrict cumulative metrics from being used with date part,
which matches existing query behavior. This required adding a DATE_PART
LinkableElementProperty and updating LinkableDimensions accordingly.
Also updates related date part properties.
This logic is only hit for certain types of metrics (like cumulative and
 derived metrics) so I didn't catch it until adding tests for those
metric types.
@courtneyholcomb courtneyholcomb enabled auto-merge (squash) September 24, 2024 22:41
@courtneyholcomb courtneyholcomb merged commit 963b4e1 into main Sep 24, 2024
14 checks passed
@courtneyholcomb courtneyholcomb deleted the court/parse-custom-3 branch September 24, 2024 22:43
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.

3 participants