Skip to content

Commit

Permalink
Migrate test YAML syntax to new data_test namespace to makeway for un…
Browse files Browse the repository at this point in the history
…it_tests
  • Loading branch information
JonCrawford committed Apr 4, 2024
1 parent e22c717 commit e2df201
Show file tree
Hide file tree
Showing 55 changed files with 791 additions and 558 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/dbt-checkpoint/dbt-checkpoint
rev: v1.1.1
rev: v1.2.1
hooks:
- id: dbt-docs-generate
- id: check-script-semicolon
Expand All @@ -11,7 +11,7 @@ repos:
- id: generate-model-properties-file
args: ["--properties-file", "./models/mesa/{name}.yml", "--"]

- id: unify-column-description
#- id: unify-column-description
- id: check-column-name-contract
args: [--pattern, "(is|has|do)_.*", --dtype, boolean]
- id: check-model-has-all-columns
Expand Down
23 changes: 12 additions & 11 deletions models/customer_io/staging/_stg_email_clicks.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
version: 2

models:
- name: stg_email_clicks
description: "Email clicks from Customer.io"
tags: ["staging", "customer_io"]
description: Email clicks from Customer.io
tags:
- staging
- customer_io
columns:
- name: delivery_id
description: "Unique ID for the email delivery"
tests:
- not_null
- name: shop_subdomain
description: "Shopify subdomain"
tests:
- not_null
- name: delivery_id
description: Unique ID for the email delivery
data_tests:
- not_null
- name: shop_subdomain
description: The foreign key for the Shop.
data_tests:
- not_null
21 changes: 11 additions & 10 deletions models/customer_io/staging/_stg_email_conversions.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
version: 2

models:
- name: stg_email_conversions
description: Staging table for email conversion details
tags: ["staging", "customer_io"]
tags:
- staging
- customer_io
columns:
- name: delivery_id
description: "Unique ID for the email delivery"
tests:
- not_null
- name: shop_subdomain
description: "Shopify subdomain"
tests:
- not_null
- name: delivery_id
description: Unique ID for the email delivery
data_tests:
- not_null
- name: shop_subdomain
description: The foreign key for the Shop.
data_tests:
- not_null
23 changes: 12 additions & 11 deletions models/customer_io/staging/_stg_email_opens.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
version: 2

models:
- name: stg_email_opens
description: "Email opens from Customer.io"
tags: ["staging", "customer_io"]
description: Email opens from Customer.io
tags:
- staging
- customer_io
columns:
- name: delivery_id
description: "Unique ID for the email delivery"
tests:
- not_null
- name: shop_subdomain
description: "Shopify subdomain"
tests:
- not_null
- name: delivery_id
description: Unique ID for the email delivery
data_tests:
- not_null
- name: shop_subdomain
description: The foreign key for the Shop.
data_tests:
- not_null
6 changes: 3 additions & 3 deletions models/generic/_currency_conversion_rates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ models:
- name: currency_conversion_rates
columns:
- name: CURRENCY
tests:
data_tests:
- not_null
- unique
- name: IN_USD
tests:
data_tests:
- not_null
- name: EXCHANGE_RATE_AT
tests:
data_tests:
- not_null
14 changes: 7 additions & 7 deletions models/generic/intermediate/_int_shop_infos.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
version: 2

models:
- name: int_shop_infos
description: "Intermediate table for shop information"
tags: ["intermediate"]
description: Intermediate table for shop information
tags:
- intermediate
columns:
- name: shop_subdomain
description: Shopify subdomain
tests:
description: The foreign key for the Shop.
data_tests:
- unique
- name: updated_at
description: The date the shop info was updated.
tests:
description: Used to build incremental models.
data_tests:
- not_null
13 changes: 7 additions & 6 deletions models/generic/staging/_stg_constellation_users.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
version: 2

models:
- name: stg_constellation_users
description: >
This table contains all users in the ShopPad ecosystem.
tags: ["staging"]
description: "This table contains all users in the ShopPad ecosystem.
"
tags:
- staging
columns:
- name: shop_subdomain
description: Shopify subdomain
tests:
description: The foreign key for the Shop.
data_tests:
- unique
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
version: 2
models:
- name: int_app_store_attribution
tests:
data_tests:
- dbt_expectations.expect_table_row_count_to_be_between:
min_value: 200
columns:
- name: shop_subdomain
tests:
data_tests:
- unique
- not_null
description: The foreign key for the Shop.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2
models:
- name: int_ga_first_visits
tests:
data_tests:
- dbt_expectations.expect_table_row_count_to_be_between:
min_value: 100
description: ""
Expand Down Expand Up @@ -41,6 +41,6 @@ models:
description: The locale of the first touch in the app store.
- name: shop_subdomain
description: The foreign key for the Shop.
tests:
data_tests:
- not_null
- unique
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ models:
- name: app_store_locale
- name: app_store_detail
- name: event_name
tests:
data_tests:
- dbt_expectations.expect_column_distinct_count_to_be_greater_than:
value: 0
row_condition: event_name = 'shopify_app_install'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
models:
- name: stg_anonymous_to_known_user_matching
description: Matches Google anonymous IDs and shop_subdomains. May contain multiple rows for the same subdomain.
tests:
data_tests:
- dbt_expectations.expect_table_row_count_to_be_between:
min_value: 1000

Expand All @@ -21,5 +21,5 @@ models:
description: The anonymouse Google Analytics user ID
- name: SHOP_SUBDOMAIN
description: The foreign key of the Shop.
tests:
data_tests:
- not_null
2 changes: 1 addition & 1 deletion models/mesa/intermediate/_int_first_workflow_keys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ models:
columns:
- name: shop_subdomain
description: The foreign key for the Shop.
tests:
data_tests:
- unique
- not_null
- name: first_workflow_trigger_app
Expand Down
5 changes: 3 additions & 2 deletions models/mesa/intermediate/_int_mesa_flow_events.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ models:
- name: int_mesa_flow_events
columns:
- name: shop_subdomain
tests:
data_tests:
- not_null
- relationships:
to: ref('int_shops')
Expand Down Expand Up @@ -37,7 +37,7 @@ models:
- name: context_campaign_content
- name: event_text
- name: id
tests:
data_tests:
- unique
- name: properties_action
- name: properties_goal
Expand Down Expand Up @@ -79,6 +79,7 @@ models:
- name: category
- name: value
- name: key
description: The code-friendly key of the workflow.
- name: workflow_id
description: The foreign key to the originating workflow
- name: source
Expand Down
24 changes: 12 additions & 12 deletions models/mesa/intermediate/_int_mesa_shop_days.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2
models:
- name: int_mesa_shop_days
tests:
data_tests:
- dbt_expectations.expect_table_row_count_to_be_between:
min_value: 1
config:
Expand All @@ -12,7 +12,7 @@ models:
- shop_subdomain
columns:
- name: shop_subdomain
tests:
data_tests:
- not_null
- relationships:
to: ref('int_shops')
Expand All @@ -21,45 +21,45 @@ models:
where: mesa_plan != 'custom-app'
description: The foreign key for the Shop.
- name: dt
tests:
data_tests:
- not_null
- dbt_utils.accepted_range:
max_value: current_date()
description: The calendar date of the shop day.
- name: workflow_runs_attempted_count
tests:
data_tests:
- not_null
description: The number of Workflow Run attempts that have been started.
- name: workflow_runs_success_count
tests:
data_tests:
- not_null
description: The number of workflow runs that succeeded on this day.
- name: workflow_success_percent
tests:
data_tests:
- not_null
description: The percentage of workflow runs that succeeded on this day.
- name: billed_count
tests:
data_tests:
- not_null
description: "[Fill]"
- name: daily_usage_revenue
tests:
data_tests:
- not_null
description: The amount of revenue from usage charges for this day.
- name: workflow_run_success_rolling_thirty_day_count
tests:
data_tests:
- not_null
description: The number of successful workflow run attempts initiated in the last 30 days as of this day.
- name: workflow_run_success_rolling_year_count
tests:
data_tests:
- not_null
description: The number of successful workflow run attempts initiated in the last year as of this day.
- name: is_active
tests:
data_tests:
- not_null
description: Whether the shop is considered active on this day.
- name: mesa_shop_days_id
tests:
data_tests:
- not_null
- unique
description: Unique identifier for each row
Expand Down
2 changes: 1 addition & 1 deletion models/mesa/intermediate/_int_mesa_shop_plan_days.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2
models:
- name: int_mesa_shop_plan_days
tests:
data_tests:
- dbt_expectations.expect_compound_columns_to_be_unique:
column_list:
- dt
Expand Down
16 changes: 11 additions & 5 deletions models/mesa/intermediate/_int_shop_calendar.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
version: 2
models:
- name: int_shop_calendar
tests:
data_tests:
- dbt_expectations.expect_compound_columns_to_be_unique:
column_list:
- dt
- shop_subdomain
columns:
- name: shop_subdomain
type: string
tests:
data_tests:
- not_null
description: The foreign key for the Shop.
- name: dt
tests:
data_tests:
- not_null
description: The calendar date of the shop day.
- name: daily_plan_revenue
tests:
data_tests:
- not_null
description: The amount of revenue from plan charges for this day.
- name: MESA_PLAN
- name: SHOPIFY_PLAN
- name: is_shopify_zombie_plan
tests:
data_tests:
- not_null
description:
Indicates whether the store is on a 'frozen', 'fraudulent', 'paused',
'dormant' or 'cancelled' Shopify plan. TRUE means they are, FALSE means they
are not.
Loading

0 comments on commit e2df201

Please sign in to comment.