Skip to content

Commit

Permalink
test dbt's model contracts feature. Atm dbt only supports "all column…
Browse files Browse the repository at this point in the history
…s" contract, follow dbt-labs/dbt-core#7432 for partial contract feature update
  • Loading branch information
tu.pham committed Jan 29, 2024
1 parent 31e0392 commit a92533a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions dags/dbt/airbnb_bigquery/models/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ models:
tests:
- unique
- name: facts_listings
config:
contract:
enforced: true
columns:
- name: listing_id
data_type: string
tests:
- dbt_utils.equal_rowcount:
compare_model: ref('listings_stg')
Expand Down
3 changes: 2 additions & 1 deletion dags/dbt/airbnb_bigquery/models/warehouse/facts_listings.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
},
materialized='incremental',
incremental_strategy='insert_overwrite',
partitions=model_params.partitions_quoted
partitions=model_params.partitions_quoted,
on_schema_change='append_new_columns'
)
}}

Expand Down

0 comments on commit a92533a

Please sign in to comment.