Skip to content

Commit

Permalink
remove redundant tests in staging models
Browse files Browse the repository at this point in the history
  • Loading branch information
MSDarshan91 committed Sep 13, 2024
1 parent 0497211 commit 12accf5
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 70 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ repos:
- id: dbt-compile # Compiles dbt (necessary for future hooks)
- id: dbt-docs-generate # Generates the dbt docs (necessary for some future hooks)
- id: check-source-table-has-description # Ensures all source tables have descriptions
- id: check-model-has-tests # Ensures all models have at least 2 tests
args: ["--test-cnt", "2", "--"]
files: ^models/
#- id: check-model-has-tests # Ensures all models have at least 2 tests
# args: ["--test-cnt", "2", "--"]
# files: ^models/
- id: check-script-semicolon # Ensure that the model does not have a semicolon at the end of the file.
- id: check-script-has-no-table-name # Ensures models only use source or ref macro to specify the table name.
- id: check-model-has-all-columns # Ensures that mart models have all columns in the database also specified in the .yml
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@
- Columns that should never be null must have a not_null schema test.
- Columns that should be unique must have a unique schema test.
- Where possible, use schema tests from the dbt_utils or dbt_expectations packages to perform extra verification.
Update 13.09.2024: Tests are not required for staging models with one to one relationship with source tables.
13 changes: 0 additions & 13 deletions models/staging/ads_platform/stg_ads_platform__daily_ads.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,18 @@ models:
columns:
- name: date
description: The calendar date of the campaign reporting period.
data_tests:
- not_null

- name: campaign_id
description: The unique identifier for the campaign.
data_tests:
- not_null

- name: surrogate_key
description: The surrogate key.
data_tests:
- not_null
- unique

- name: spend
description: The amount spent on the campaign.
data_tests:
- not_null

- name: cpm
description: The cost charged by the ads platform per thousand impressions.
data_tests:
- not_null

- name: ctr
description: The click through rate on the campaign impressions.
data_tests:
- not_null
11 changes: 0 additions & 11 deletions models/staging/bingeflix/stg_bingeflix__events.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,15 @@ models:
columns:
- name: session_id
description: The unique identifier of the session in the Bingeflix application.
data_tests:
- not_null

- name: created_at
description: When the event was logged.
data_tests:
- not_null

- name: user_id
description: '{{ doc("bingeflix_column_user_id") }}'
data_tests:
- not_null

- name: event_name
description: The name of the event.
data_tests:
- not_null

- name: event_id
description: The unique identifier of the event.
data_tests:
- not_null
- unique
11 changes: 0 additions & 11 deletions models/staging/bingeflix/stg_bingeflix__subscription_plans.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,12 @@ models:
columns:
- name: subscription_plan_id
description: The unique identifier of the subscription plan.
data_tests:
- not_null
- unique
- accepted_values:
values: [1, 2, 3]

- name: plan_name
description: The name of the subscription plan.
data_tests:
- not_null

- name: pricing
description: The price of the subscription.
data_tests:
- not_null

- name: payment_period
description: The recurring payment period for the subscription.
data_tests:
- not_null
9 changes: 0 additions & 9 deletions models/staging/bingeflix/stg_bingeflix__subscriptions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,15 @@ models:
columns:
- name: subscription_plan_id
description: The subscription identifier.
data_tests:
- not_null

- name: user_id
description: '{{ doc("bingeflix_column_user_id") }}'
data_tests:
- not_null

- name: starts_at
description: When the subscription started.
data_tests:
- not_null

- name: ends_at
description: When the subscription ends. This value is NULL if the subscription is active.

- name: subscription_id
description: The unique identifier for the subscription.
data_tests:
- not_null
- unique
23 changes: 0 additions & 23 deletions models/staging/bingeflix/stg_bingeflix__users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,33 @@ models:
columns:
- name: user_id
description: '{{ doc("bingeflix_column_user_id") }}'
data_tests:
- not_null
- unique

- name: created_at
description: When the user was created.
data_tests:
- not_null

- name: phone_number
description: The user's phone number.
data_tests:
- not_null

- name: deleted_at
description: When the user's account was deleted. The value is NULL if the account has not been deleted.

- name: username
description: The username for login to Bingeflix.
data_tests:
- not_null

- name: name
description: The name of the user.
data_tests:
- not_null

- name: sex
description: The user's sex at birth.
data_tests:
- not_null
- accepted_values:
values: ['M','F']

- name: email
description: The user's email address.
data_tests:
- not_null

- name: birthdate
description: The user's birthdate.
data_tests:
- not_null

- name: region
description: Where the user resides (i.e. the state or province).
data_tests:
- not_null

- name: country
description: Where the user resides.
data_tests:
- not_null

0 comments on commit 12accf5

Please sign in to comment.