Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
dave-connors-3 committed May 23, 2024
1 parent 5a0209a commit c8a2b0b
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 17 deletions.
76 changes: 59 additions & 17 deletions schemas/latest/dbt_yml_files-latest.json
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,9 @@
},
"label": {
"type": "string"
},
"type_params": {
"type": "object"
}
},
"additionalProperties": false
Expand All @@ -365,9 +368,6 @@
"description": {
"type": "string"
},
"deprecation_date": {
"type": "string"
},
"access": {
"type": "string",
"enum": [
Expand All @@ -394,6 +394,9 @@
"$ref": "#/$defs/data_tests"
}
},
"deprecation_date": {
"type": "string"
},
"docs": {
"$ref": "#/$defs/docs_config"
},
Expand Down Expand Up @@ -1129,20 +1132,59 @@
"conversion_metric_type_params": {
"type": "object",
"properties": {
"measure": {
"$ref": "#/$defs/metric_input_measure"
},
"metrics": {
"type": "array",
"items": {
"$ref": "#/$defs/metric_input_schema"
}
},
"numerator": {
"$ref": "#/$defs/metric_input_measure"
},
"window": {
"type": "string"
"conversion_type_params": {
"type": "object",
"required": [
"entity",
"base_measure",
"conversion_measure"
],
"properties": {
"base_measure": {
"$ref": "#/$defs/metric_input_measure"
},
"calculation": {
"type": "string",
"default": "conversion_rate",
"enum": [
"conversions",
"conversion_rate",
"CONVERSIONS",
"CONVERSION_RATE"
]
},
"constant_properties": {
"type": "array",
"items": {
"type": "object",
"required": [
"base_property",
"conversion_property"
],
"properties": {
"base_property": {
"description": "DIMENSION or ENTITY",
"type": "string"
},
"conversion_property": {
"description": "DIMENSION or ENTITY",
"type": "string"
}
}
}
},
"conversion_measure": {
"$ref": "#/$defs/metric_input_measure"
},
"entity": {
"description": "The entity to calculate over",
"type": "string"
},
"window": {
"type": "string"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
Expand Down
60 changes: 60 additions & 0 deletions tests/latest/invalid/dbt_yml_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,66 @@ metrics:
calculation_method: derived
expression: "{{ metric('new_customers') }} * 2"

- name: new_customer
description: Unique count of new customers.
label: New Customers
type: simple
type_params:
measure:
name: customers_with_orders
metrics:
- name: order_total
alias: revenue
filter: |
{{ Dimension('order__is_food_order') }} = True
window: 1 month
filter: |
{{ Dimension('customer__customer_type') }} = 'new'
- name: food_order_gross_profit
label: Food order gross profit
description: "The gross profit for each food order."
type: derived
type_params:
expr: revenue - cost
measure:
name: customers_with_orders
metrics:
- name: order_total
alias: revenue
filter: |
{{ Dimension('order__is_food_order') }} = True
- name: order_cost
alias: cost
filter: |
{{ Dimension('order__is_food_order') }} = True
- name: cumulative_order_total_l1m
label: Cumulative Order total (L1M)
description: Trailing 1-month cumulative order amount
type: joel
type_params:
measure:
name: order_total
fill_nulls_with: 0
window: 1 month

- name: visit_to_buy_conversion_rate_7_day_window
description: "Conversion rate from viewing a page to making a purchase"
type: conversion
label: Visit to Seller Conversion Rate (7 day window)
type_params:
conversion_type_params:
expr: revenue - cost
calculation: conversions
base_measure:
name: visits
conversion_measure:
name: buys
fill_nulls_with: 0
entity: user
window: 7 days


unit_tests:
- name: some_unit_test
Expand Down
42 changes: 42 additions & 0 deletions tests/latest/valid/dbt_yml_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ metrics:
name: customers_with_orders
fill_nulls_with: 0
join_to_timespine: true

- name: new_customer
description: Unique count of new customers.
label: New Customers
Expand All @@ -209,6 +210,47 @@ metrics:
filter: |
"{{ Dimension('transaction__location') }} = 'US'"
- name: food_order_gross_profit
label: Food order gross profit
description: "The gross profit for each food order."
type: derived
type_params:
expr: revenue - cost
metrics:
- name: order_total
alias: revenue
filter: |
{{ Dimension('order__is_food_order') }} = True
- name: order_cost
alias: cost
filter: |
{{ Dimension('order__is_food_order') }} = True
- name: cumulative_order_total_l1m
label: Cumulative Order total (L1M)
description: Trailing 1-month cumulative order amount
type: cumulative
type_params:
measure:
name: order_total
fill_nulls_with: 0
window: 1 month

- name: visit_to_buy_conversion_rate_7_day_window
description: "Conversion rate from viewing a page to making a purchase"
type: conversion
label: Visit to Seller Conversion Rate (7 day window)
type_params:
conversion_type_params:
calculation: conversions
base_measure:
name: visits
conversion_measure:
name: buys
fill_nulls_with: 0
entity: user
window: 7 days

saved_queries:
- name: test_saved_query
description: "{{ doc('saved_query_description') }}"
Expand Down

0 comments on commit c8a2b0b

Please sign in to comment.