Skip to content

Commit

Permalink
added fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamDee committed Dec 8, 2023
1 parent 67cfe44 commit 0448158
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,30 @@ metric:
name: bookings
join_to_timespine: true
---
metric:
name: visit_buy_conversion_rate
description: conversion rate on visits-buys on a 7 day window
type: conversion
type_params:
conversion_type_params:
base_measure: visits
conversion_measure: buys
window: 7 days
entity: user
calculation: conversion_rate
---
metric:
name: visit_buy_conversions
description: conversion count on visits-buys on a 7 day window
type: conversion
type_params:
conversion_type_params:
base_measure: visits
conversion_measure: buys
window: 7 days
entity: user
calculation: conversions
---
metric:
name: bookings_fill_nulls_with_0_without_time_spine
description: Simple metric filling 0 without time spine. Not a commonly expected scenario.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
semantic_model:
name: buys_source
description: buys_source

node_relation:
schema_name: $source_schema
alias: fct_buys

defaults:
agg_time_dimension: ds

measures:
- name: buys
expr: 1
agg: count
- name: buyers
expr: user_id
agg: count_distinct

dimensions:
- name: ds
type: time
type_params:
time_granularity: day

primary_entity: buy

entities:
- name: user
type: foreign
expr: user_id
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
semantic_model:
name: visits_source
description: visits_source

node_relation:
schema_name: $source_schema
alias: fct_visits

defaults:
agg_time_dimension: ds

measures:
- name: visits
expr: 1
agg: count
- name: visitors
expr: user_id
agg: count_distinct

dimensions:
- name: ds
type: time
type_params:
time_granularity: day
- name: referrer_id
type: categorical

primary_entity: visit

entities:
- name: user
type: foreign
expr: user_id
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
table_snapshot:
table_name: fct_buys
column_definitions:
- name: ds
type: TIME
- name: user_id
type: STRING
rows:
- ["2020-01-02", "u0004114"]
- ["2020-01-03", "u0042324"]
- ["2020-01-03", "u0042324"]
- ["2020-01-04", "u0005432"]
- ["2020-01-04", "u0003452"]
- ["2020-01-07", "u1612112"]
- ["2020-01-07", "u0004114"]
- ["2020-01-07", "u0003141"]
- ["2020-01-10", "u0004117"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
table_snapshot:
table_name: fct_visits
column_definitions:
- name: user_id
type: STRING
- name: ds
type: TIME
- name: referrer_id
type: STRING
rows:
- ["u0004114", "2020-01-01", "fb_ad_1"]
- ["u0004214", "2020-01-01", "fb_ad_2"]
- ["u0003141", "2020-01-01", "homepage_1"]
- ["u0003154", "2020-01-01", "homepage_2"]
- ["u1612112", "2020-01-02", "homepage_1"]
- ["u0005432", "2020-01-02", "fb_ad_3"]
- ["u0003452", "2020-01-02", "fb_ad_1"]
- ["u0003452", "2020-01-02", "user_2"]
- ["u0042324", "2020-01-03", "fb_ad_1"]
- ["u0005432", "2020-01-03", "google_ad_1"]
- ["u0005472", "2020-01-03", "google_ad_2"]
- ["u0005414", "2020-01-04", "google_ad_1"]
- ["u0004114", "2020-01-06", "homepage_1"]
- ["u0004114", "2020-01-07", "fb_ad_2"]
- ["u0004117", "2020-01-10", "google_ad_1"]
- ["u0003141", "2020-01-12", "user_1"]

0 comments on commit 0448158

Please sign in to comment.