diff --git a/code_thingies/dbtlearn/models/schema.yml b/code_thingies/dbtlearn/models/schema.yml new file mode 100644 index 0000000..b1f9258 --- /dev/null +++ b/code_thingies/dbtlearn/models/schema.yml @@ -0,0 +1,27 @@ +version: 2 + +models: + - name: dim_listings_cleansed + columns: + - name: listing_id + tests: + - unique + - not_null + + - name: host_id + tests: + - not_null + - relationships: + to: ref('dim_hosts_cleansed') + field: host_id + + - name: room_type + tests: + - accepted_values: + values: [ + 'Entire home/apt', + 'Private room', + 'Shared room', + 'Hotel room' + ] + diff --git a/code_thingies/dbtlearn/tests/consistent_created_at.sql b/code_thingies/dbtlearn/tests/consistent_created_at.sql new file mode 100644 index 0000000..2fb6893 --- /dev/null +++ b/code_thingies/dbtlearn/tests/consistent_created_at.sql @@ -0,0 +1,9 @@ +SELECT * +FROM + {{ ref('fact_reviews') }} fr +LEFT JOIN + {{ ref('dim_listings_cleansed') }} dl +ON + fr.listing_id = dl.listing_id +WHERE + fr.review_date < dl.created_at \ No newline at end of file diff --git a/code_thingies/dbtlearn/tests/dim_listings_minimum_nights.sql b/code_thingies/dbtlearn/tests/dim_listings_minimum_nights.sql new file mode 100644 index 0000000..8dfaa20 --- /dev/null +++ b/code_thingies/dbtlearn/tests/dim_listings_minimum_nights.sql @@ -0,0 +1,5 @@ +SELECT * +FROM + {{ ref('dim_listings_cleansed') }} +WHERE + mininum_nights < 1