-
Notifications
You must be signed in to change notification settings - Fork 12
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
Create protocol abstraction for Measures
#14
Comments
Proposed implementation class NonAdditiveDimensionParametersProtocol(Protocol):
name: str
window_choice: AggregationType
window_groupings: List[str]
class MeasureAggregationParametersProtocol(Protocol):
percentile: Optional[float]
use_discrete_percentile: bool
use_approximate_percentile: bool
class MeasureProtocol(Protocol):
name: str
agg: AggregationType
description: Optional[str]
create_metric: Optional[bool]
expr: Optional[str]
agg_params: Optional[MeasureAggregationParametersProtocol]
non_additive_dimension: Optional[NonAdditiveDimensionParametersProtocol]
agg_time_dimension: Optional[str]
checked_agg_time_dimension: TimeDimensionReference
reference: MeasureReference |
@WilliamDee can I get your 👀 on this to see if it passes the sniff test? |
@callum-mcdata This looks right! Question I had is do we necessarily need the properties being a protocol as well (ie., |
I think @QMalcolm is probably the best person to answer this. I have no strong opinons one way or another on how we want to implement this 🤔 Additionally I've edited the proposal based on a conversation he and I had offline around whether we want default implementations for property methods. He recommended that we instead define the shape of those properties and core is free to implement them as they see fit. |
We want a standard definition of what a valid
Measure
implementation should have. This allows for a shared definition to be understood in MetricFlow and dbt-core of what anything implementing theMeasure
protocol will make available without MetricFlow and dbt-core needing to import each other. This should use the newProtocol
type which exists in python 3.8+The text was updated successfully, but these errors were encountered: