Skip to content

Commit

Permalink
Add snapshots for query parser.
Browse files Browse the repository at this point in the history
  • Loading branch information
plypaul committed May 15, 2024
1 parent febddc2 commit b865f97
Show file tree
Hide file tree
Showing 10 changed files with 279 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ParseQueryResult(
query_spec=MetricFlowQuerySpec(
metric_specs=(MetricSpec(element_name='revenue_cumulative'),),
time_dimension_specs=(
TimeDimensionSpec(
element_name='ds',
entity_links=(EntityReference(element_name='revenue_instance'),),
time_granularity=MONTH,
),
),
filter_intersection=PydanticWhereFilterIntersection(),
filter_spec_resolution_lookup=FilterSpecResolutionLookUp(),
min_max_only=False,
),
queried_semantic_models=(SemanticModelReference(semantic_model_name='revenue_source'),),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ParseQueryResult(
query_spec=MetricFlowQuerySpec(
metric_specs=(MetricSpec(element_name='revenue_growth_2_weeks'),),
time_dimension_specs=(TimeDimensionSpec(element_name='metric_time', time_granularity=MONTH),),
filter_intersection=PydanticWhereFilterIntersection(),
filter_spec_resolution_lookup=FilterSpecResolutionLookUp(),
min_max_only=False,
),
queried_semantic_models=(SemanticModelReference(semantic_model_name='revenue_source'),),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
ParseQueryResult(
query_spec=MetricFlowQuerySpec(
metric_specs=(MetricSpec(element_name='bookings'), MetricSpec(element_name='revenue')),
time_dimension_specs=(TimeDimensionSpec(element_name='metric_time', time_granularity=MONTH),),
order_by_specs=(
OrderBySpec(
instance_spec=TimeDimensionSpec(element_name='metric_time', time_granularity=MONTH),
descending=True,
),
),
filter_intersection=PydanticWhereFilterIntersection(),
filter_spec_resolution_lookup=FilterSpecResolutionLookUp(),
min_max_only=False,
),
queried_semantic_models=(
SemanticModelReference(semantic_model_name='bookings_source'),
SemanticModelReference(semantic_model_name='revenue_source'),
),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ParseQueryResult(
query_spec=MetricFlowQuerySpec(
metric_specs=(MetricSpec(element_name='bookings'),),
time_dimension_specs=(TimeDimensionSpec(element_name='metric_time', time_granularity=DAY),),
order_by_specs=(
OrderBySpec(
instance_spec=TimeDimensionSpec(element_name='metric_time', time_granularity=DAY),
descending=False,
),
),
filter_intersection=PydanticWhereFilterIntersection(),
filter_spec_resolution_lookup=FilterSpecResolutionLookUp(),
min_max_only=False,
),
queried_semantic_models=(SemanticModelReference(semantic_model_name='bookings_source'),),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
ParseQueryResult(
query_spec=MetricFlowQuerySpec(
metric_specs=(MetricSpec(element_name='bookings'),),
time_dimension_specs=(TimeDimensionSpec(element_name='metric_time', time_granularity=DAY),),
time_range_constraint=TimeRangeConstraint(
start_time=datetime.datetime(2020, 1, 15, 0, 0),
end_time=datetime.datetime(2020, 2, 15, 0, 0),
),
filter_intersection=PydanticWhereFilterIntersection(
where_filters=[
PydanticWhereFilter(
where_sql_template="{{ Dimension('booking__is_instant') }} = '1'",
),
],
),
filter_spec_resolution_lookup=FilterSpecResolutionLookUp(
spec_resolutions=(
FilterSpecResolution(
lookup_key=ResolvedSpecLookUpKey(
filter_location=WhereFilterLocation(
metric_references=(
MetricReference(
element_name='bookings',
),
),
),
call_parameter_set=DimensionCallParameterSet(
entity_path=(
EntityReference(
element_name='booking',
),
),
dimension_reference=DimensionReference(
element_name='is_instant',
),
),
),
where_filter_intersection=PydanticWhereFilterIntersection(
where_filters=[
PydanticWhereFilter(
where_sql_template="{{ Dimension('booking__is_instant') }} = '1'",
),
],
),
resolved_linkable_element_set=LinkableElementSet(
path_key_to_linkable_dimensions={
ElementPathKey(
element_name='is_instant',
element_type=DIMENSION,
entity_links=(
EntityReference(
element_name='booking',
),
),
): (
LinkableDimension(
semantic_model_origin=SemanticModelReference(
semantic_model_name='bookings_source',
),
element_name='is_instant',
dimension_type=CATEGORICAL,
entity_links=(
EntityReference(
element_name='booking',
),
),
join_path=SemanticModelJoinPath(
left_semantic_model_reference=SemanticModelReference(
semantic_model_name='bookings_source',
),
),
properties=frozenset(
'LOCAL',
),
),
),
},
),
spec_pattern=DimensionPattern(
parameter_set=EntityLinkPatternParameterSet(
fields_to_compare=(
ELEMENT_NAME,
ENTITY_LINKS,
),
element_name='is_instant',
entity_links=(
EntityReference(
element_name='booking',
),
),
),
),
filter_location_path=MetricFlowQueryResolutionPath(
resolution_path_nodes=(
QueryGroupByItemResolutionNode(node_id=qr_5),
),
),
object_builder_str="Dimension('booking__is_instant')",
),
),
),
min_max_only=False,
),
queried_semantic_models=(SemanticModelReference(semantic_model_name='bookings_source'),),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ParseQueryResult(
query_spec=MetricFlowQuerySpec(
metric_specs=(MetricSpec(element_name='bookings'),),
dimension_specs=(
DimensionSpec(
element_name='is_instant',
entity_links=(EntityReference(element_name='booking'),),
),
),
entity_specs=(EntitySpec(element_name='listing'),),
time_dimension_specs=(TimeDimensionSpec(element_name='metric_time', time_granularity=DAY),),
order_by_specs=(
OrderBySpec(
instance_spec=TimeDimensionSpec(element_name='metric_time', time_granularity=DAY),
descending=False,
),
OrderBySpec(instance_spec=MetricSpec(element_name='bookings'), descending=True),
),
filter_intersection=PydanticWhereFilterIntersection(),
filter_spec_resolution_lookup=FilterSpecResolutionLookUp(),
min_max_only=False,
),
queried_semantic_models=(SemanticModelReference(semantic_model_name='bookings_source'),),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ParseQueryResult(
query_spec=MetricFlowQuerySpec(
metric_specs=(MetricSpec(element_name='bookings'),),
dimension_specs=(
DimensionSpec(
element_name='is_instant',
entity_links=(EntityReference(element_name='booking'),),
),
),
entity_specs=(EntitySpec(element_name='listing'),),
time_dimension_specs=(TimeDimensionSpec(element_name='metric_time', time_granularity=DAY),),
order_by_specs=(
OrderBySpec(
instance_spec=TimeDimensionSpec(element_name='metric_time', time_granularity=DAY),
descending=False,
),
OrderBySpec(instance_spec=MetricSpec(element_name='bookings'), descending=True),
),
filter_intersection=PydanticWhereFilterIntersection(),
filter_spec_resolution_lookup=FilterSpecResolutionLookUp(),
min_max_only=False,
),
queried_semantic_models=(SemanticModelReference(semantic_model_name='bookings_source'),),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ParseQueryResult(
query_spec=MetricFlowQuerySpec(
metric_specs=(MetricSpec(element_name='bookings'),),
dimension_specs=(
DimensionSpec(
element_name='is_instant',
entity_links=(EntityReference(element_name='booking'),),
),
),
entity_specs=(EntitySpec(element_name='listing'),),
time_dimension_specs=(TimeDimensionSpec(element_name='metric_time', time_granularity=DAY),),
order_by_specs=(
OrderBySpec(
instance_spec=TimeDimensionSpec(element_name='metric_time', time_granularity=DAY),
descending=False,
),
OrderBySpec(instance_spec=MetricSpec(element_name='bookings'), descending=True),
),
filter_intersection=PydanticWhereFilterIntersection(),
filter_spec_resolution_lookup=FilterSpecResolutionLookUp(),
min_max_only=False,
),
queried_semantic_models=(SemanticModelReference(semantic_model_name='bookings_source'),),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ParseQueryResult(
query_spec=MetricFlowQuerySpec(
metric_specs=(MetricSpec(element_name='bookings'),),
dimension_specs=(
DimensionSpec(
element_name='is_instant',
entity_links=(EntityReference(element_name='booking'),),
),
),
entity_specs=(EntitySpec(element_name='listing'),),
time_dimension_specs=(TimeDimensionSpec(element_name='metric_time', time_granularity=DAY),),
order_by_specs=(
OrderBySpec(
instance_spec=TimeDimensionSpec(element_name='metric_time', time_granularity=DAY),
descending=False,
),
OrderBySpec(instance_spec=MetricSpec(element_name='bookings'), descending=True),
),
filter_intersection=PydanticWhereFilterIntersection(),
filter_spec_resolution_lookup=FilterSpecResolutionLookUp(),
min_max_only=False,
),
queried_semantic_models=(SemanticModelReference(semantic_model_name='bookings_source'),),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
ParseQueryResult(
query_spec=MetricFlowQuerySpec(
metric_specs=(MetricSpec(element_name='bookings'), MetricSpec(element_name='revenue')),
time_dimension_specs=(TimeDimensionSpec(element_name='metric_time', time_granularity=MONTH),),
time_range_constraint=TimeRangeConstraint(
start_time=datetime.datetime(2020, 1, 1, 0, 0),
end_time=datetime.datetime(2020, 2, 29, 0, 0),
),
filter_intersection=PydanticWhereFilterIntersection(),
filter_spec_resolution_lookup=FilterSpecResolutionLookUp(),
min_max_only=False,
),
queried_semantic_models=(
SemanticModelReference(semantic_model_name='bookings_source'),
SemanticModelReference(semantic_model_name='revenue_source'),
),
)

0 comments on commit b865f97

Please sign in to comment.