Skip to content

Commit

Permalink
Add new measures/metrics for testing metrics that join to time spine …
Browse files Browse the repository at this point in the history
…with sub-daily granularities
  • Loading branch information
courtneyholcomb committed Jul 30, 2024
1 parent cf47d11 commit 9203d45
Show file tree
Hide file tree
Showing 18 changed files with 81 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,55 @@ semantic_model:
expr: "1"
agg: SUM
create_metric: true
- name: archived_users
expr: "1"
agg: SUM
create_metric: true
agg_time_dimension: archived_at
---
metric:
name: subdaily_cumulative_window_metric
description: cumulative window metric with a sub-daily agg time dim
type: cumulative
type_params:
measure: archived_users
cumulative_type_params:
window: 3 hours
---
metric:
name: subdaily_cumulative_grain_to_date_metric
description: cumulative grain to date metric with a sub-daily agg time dim
type: cumulative
type_params:
measure: archived_users
cumulative_type_params:
grain_to_date: hour
---
metric:
name: subdaily_offset_window_metric
description: offset window metric with a sub-daily agg time dim
type: derived
type_params:
expr: archived_users
metrics:
- name: archived_users
offset_window: 1 hour
---
metric:
name: subdaily_offset_grain_to_date_metric
description: offset grain to date metric with a sub-daily agg time dim
type: derived
type_params:
expr: archived_users
metrics:
- name: archived_users
offset_to_grain: hour
---
metric:
name: subdaily_join_to_time_spine_metric
description: simple metric with sub-daily agg time dim that joins to time spine
type: simple
type_params:
measure:
name: archived_users
join_to_timespine: true
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
'user__archived_at__quarter',
'user__archived_at__week',
'user__archived_at__year',
'user__archived_users',
'user__bio_added_ts__day',
'user__bio_added_ts__extract_day',
'user__bio_added_ts__extract_day',
Expand Down Expand Up @@ -456,6 +457,7 @@
'user__revenue_instance__user__revenue',
'user__revenue_instance__user__revenue_all_time',
'user__smallest_listing',
'user__subdaily_join_to_time_spine_metric',
'user__total_account_balance_first_day',
'user__verification__user__identity_verifications',
'user__view__user__views',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'account_balance',
'approximate_continuous_booking_value_p99',
'approximate_discrete_booking_value_p99',
'archived_users',
'average_booking_value',
'bookers',
'booking_payments',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ Model Join-Path Entity Links
('listings_latest',) ("('user',)", "('revenue_instance', 'user')") revenue ['JOINED', 'METRIC']
('listings_latest',) ("('user',)", "('revenue_instance', 'user')") revenue_all_time ['JOINED', 'METRIC']
('listings_latest',) ("('user',)", "('user',)") active_listings ['JOINED', 'METRIC']
('listings_latest',) ("('user',)", "('user',)") archived_users ['JOINED', 'METRIC']
('listings_latest',) ("('user',)", "('user',)") current_account_balance_by_user ['JOINED', 'METRIC']
('listings_latest',) ("('user',)", "('user',)") identity_verifications ['JOINED', 'METRIC']
('listings_latest',) ("('user',)", "('user',)") largest_listing ['JOINED', 'METRIC']
Expand All @@ -188,6 +189,7 @@ Model Join-Path Entity Links
('listings_latest',) ("('user',)", "('user',)") revenue ['JOINED', 'METRIC']
('listings_latest',) ("('user',)", "('user',)") revenue_all_time ['JOINED', 'METRIC']
('listings_latest',) ("('user',)", "('user',)") smallest_listing ['JOINED', 'METRIC']
('listings_latest',) ("('user',)", "('user',)") subdaily_join_to_time_spine_metric ['JOINED', 'METRIC']
('listings_latest',) ("('user',)", "('user',)") total_account_balance_first_day ['JOINED', 'METRIC']
('listings_latest',) ("('user',)", "('user',)") views ['JOINED', 'METRIC']
('listings_latest',) ("('user',)", "('user',)") visit_buy_conversion_rate ['JOINED', 'METRIC']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
'company__listing__user__company__views_times_booking_value',
'company__user',
'company__user__company__active_listings',
'company__user__company__archived_users',
'company__user__company__current_account_balance_by_user',
'company__user__company__identity_verifications',
'company__user__company__largest_listing',
Expand All @@ -99,6 +100,7 @@
'company__user__company__revenue',
'company__user__company__revenue_all_time',
'company__user__company__smallest_listing',
'company__user__company__subdaily_join_to_time_spine_metric',
'company__user__company__total_account_balance_first_day',
'company__user__company__views',
'company__user__company__visit_buy_conversion_rate',
Expand Down Expand Up @@ -452,6 +454,7 @@
'user__archived_at__extract_quarter',
'user__archived_at__extract_year',
'user__archived_at__hour',
'user__archived_users',
'user__bio_added_ts__extract_day',
'user__bio_added_ts__extract_dow',
'user__bio_added_ts__extract_doy',
Expand Down Expand Up @@ -568,6 +571,7 @@
'user__revenue_instance__user__revenue',
'user__revenue_instance__user__revenue_all_time',
'user__smallest_listing',
'user__subdaily_join_to_time_spine_metric',
'user__total_account_balance_first_day',
'user__verification__user__identity_verifications',
'user__view__user__views',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@
<!-- node_id = NodeId(id_str='ss_28011') -->
<!-- col0 = -->
<!-- SqlSelectColumn( -->
<!-- expr=SqlStringExpression(node_id=str_28008 sql_expr=1), -->
<!-- expr=SqlStringExpression(node_id=str_28009 sql_expr=1), -->
<!-- column_alias='visits', -->
<!-- ) -->
<!-- col1 = -->
Expand Down Expand Up @@ -694,7 +694,7 @@
<!-- node_id = NodeId(id_str='ss_28011') -->
<!-- col0 = -->
<!-- SqlSelectColumn( -->
<!-- expr=SqlStringExpression(node_id=str_28008 sql_expr=1), -->
<!-- expr=SqlStringExpression(node_id=str_28009 sql_expr=1), -->
<!-- column_alias='visits', -->
<!-- ) -->
<!-- col1 = -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@
<!-- node_id = NodeId(id_str='ss_28011') -->
<!-- col0 = -->
<!-- SqlSelectColumn( -->
<!-- expr=SqlStringExpression(node_id=str_28008 sql_expr=1), -->
<!-- expr=SqlStringExpression(node_id=str_28009 sql_expr=1), -->
<!-- column_alias='visits', -->
<!-- ) -->
<!-- col1 = -->
Expand Down Expand Up @@ -860,7 +860,7 @@
<!-- node_id = NodeId(id_str='ss_28011') -->
<!-- col0 = -->
<!-- SqlSelectColumn( -->
<!-- expr=SqlStringExpression(node_id=str_28008 sql_expr=1), -->
<!-- expr=SqlStringExpression(node_id=str_28009 sql_expr=1), -->
<!-- column_alias='visits', -->
<!-- ) -->
<!-- col1 = -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@
<!-- node_id = NodeId(id_str='ss_28011') -->
<!-- col0 = -->
<!-- SqlSelectColumn( -->
<!-- expr=SqlStringExpression(node_id=str_28008 sql_expr=1), -->
<!-- expr=SqlStringExpression(node_id=str_28009 sql_expr=1), -->
<!-- column_alias='visits', -->
<!-- ) -->
<!-- col1 = -->
Expand Down Expand Up @@ -753,7 +753,7 @@
<!-- node_id = NodeId(id_str='ss_28011') -->
<!-- col0 = -->
<!-- SqlSelectColumn( -->
<!-- expr=SqlStringExpression(node_id=str_28008 sql_expr=1), -->
<!-- expr=SqlStringExpression(node_id=str_28009 sql_expr=1), -->
<!-- column_alias='visits', -->
<!-- ) -->
<!-- col1 = -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@
<!-- node_id = NodeId(id_str='ss_28011') -->
<!-- col0 = -->
<!-- SqlSelectColumn( -->
<!-- expr=SqlStringExpression(node_id=str_28008 sql_expr=1), -->
<!-- expr=SqlStringExpression(node_id=str_28009 sql_expr=1), -->
<!-- column_alias='visits', -->
<!-- ) -->
<!-- col1 = -->
Expand Down Expand Up @@ -813,7 +813,7 @@
<!-- node_id = NodeId(id_str='ss_28011') -->
<!-- col0 = -->
<!-- SqlSelectColumn( -->
<!-- expr=SqlStringExpression(node_id=str_28008 sql_expr=1), -->
<!-- expr=SqlStringExpression(node_id=str_28009 sql_expr=1), -->
<!-- column_alias='visits', -->
<!-- ) -->
<!-- col1 = -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
<!-- node_id = NodeId(id_str='ss_28011') -->
<!-- col0 = -->
<!-- SqlSelectColumn( -->
<!-- expr=SqlStringExpression(node_id=str_28008 sql_expr=1), -->
<!-- expr=SqlStringExpression(node_id=str_28009 sql_expr=1), -->
<!-- column_alias='visits', -->
<!-- ) -->
<!-- col1 = -->
Expand Down Expand Up @@ -697,7 +697,7 @@
<!-- node_id = NodeId(id_str='ss_28011') -->
<!-- col0 = -->
<!-- SqlSelectColumn( -->
<!-- expr=SqlStringExpression(node_id=str_28008 sql_expr=1), -->
<!-- expr=SqlStringExpression(node_id=str_28009 sql_expr=1), -->
<!-- column_alias='visits', -->
<!-- ) -->
<!-- col1 = -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@
<!-- node_id = NodeId(id_str='ss_28011') -->
<!-- col0 = -->
<!-- SqlSelectColumn( -->
<!-- expr=SqlStringExpression(node_id=str_28008 sql_expr=1), -->
<!-- expr=SqlStringExpression(node_id=str_28009 sql_expr=1), -->
<!-- column_alias='visits', -->
<!-- ) -->
<!-- col1 = -->
Expand Down Expand Up @@ -801,7 +801,7 @@
<!-- node_id = NodeId(id_str='ss_28011') -->
<!-- col0 = -->
<!-- SqlSelectColumn( -->
<!-- expr=SqlStringExpression(node_id=str_28008 sql_expr=1), -->
<!-- expr=SqlStringExpression(node_id=str_28009 sql_expr=1), -->
<!-- column_alias='visits', -->
<!-- ) -->
<!-- col1 = -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
<!-- distinct = False -->
<MetricTimeDimensionTransformNode>
<!-- description = "Metric Time Dimension 'ds'" -->
<!-- node_id = NodeId(id_str='sma_28015') -->
<!-- node_id = NodeId(id_str='sma_28016') -->
<!-- aggregation_time_dimension = 'ds' -->
<ReadSqlSourceNode>
<!-- description = "Read From SemanticModelDataSet('views_source')" -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2183,7 +2183,7 @@
<!-- node_id = NodeId(id_str='ss_28010') -->
<!-- col0 = -->
<!-- SqlSelectColumn( -->
<!-- expr=SqlStringExpression(node_id=str_28007 sql_expr=1), -->
<!-- expr=SqlStringExpression(node_id=str_28008 sql_expr=1), -->
<!-- column_alias='views', -->
<!-- ) -->
<!-- col1 = -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,7 @@ FROM (
-- Read Elements From Semantic Model 'users_ds_source'
SELECT
1 AS new_users
, 1 AS archived_users
, DATE_TRUNC('day', users_ds_source_src_28000.ds) AS ds__day
, DATE_TRUNC('week', users_ds_source_src_28000.ds) AS ds__week
, DATE_TRUNC('month', users_ds_source_src_28000.ds) AS ds__month
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ FROM (
-- Read Elements From Semantic Model 'users_ds_source'
SELECT
1 AS new_users
, 1 AS archived_users
, DATE_TRUNC('day', users_ds_source_src_28000.ds) AS ds__day
, DATE_TRUNC('week', users_ds_source_src_28000.ds) AS ds__week
, DATE_TRUNC('month', users_ds_source_src_28000.ds) AS ds__month
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ FROM (
-- Read Elements From Semantic Model 'users_ds_source'
SELECT
1 AS new_users
, 1 AS archived_users
, DATE_TRUNC('day', users_ds_source_src_28000.ds) AS ds__day
, DATE_TRUNC('week', users_ds_source_src_28000.ds) AS ds__week
, DATE_TRUNC('month', users_ds_source_src_28000.ds) AS ds__month
Expand Down
Loading

0 comments on commit 9203d45

Please sign in to comment.