Fix typo in col name, move test to generic test
This commit is contained in:
parent
c2f2739e7e
commit
045ce1ec45
5 changed files with 14 additions and 7 deletions
8
code_thingies/dbtlearn/macros/positive_value.sql
Normal file
8
code_thingies/dbtlearn/macros/positive_value.sql
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
{% test positive_value(model, column_name) %}
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
{{ model }}
|
||||||
|
WHERE
|
||||||
|
{{ column_name }} < 1
|
||||||
|
{% endtest %}
|
||||||
|
|
@ -16,7 +16,7 @@ SELECT
|
||||||
CASE
|
CASE
|
||||||
WHEN minimum_nights = 0 THEN 1
|
WHEN minimum_nights = 0 THEN 1
|
||||||
ELSE minimum_nights
|
ELSE minimum_nights
|
||||||
END AS mininum_nights,
|
END AS minimum_nights,
|
||||||
host_id,
|
host_id,
|
||||||
REPLACE(price_str,'$','')::money AS price,
|
REPLACE(price_str,'$','')::money AS price,
|
||||||
created_at,
|
created_at,
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ SELECT
|
||||||
listings.listing_id,
|
listings.listing_id,
|
||||||
listings.listing_name,
|
listings.listing_name,
|
||||||
listings.room_type,
|
listings.room_type,
|
||||||
listings.mininum_nights,
|
listings.minimum_nights,
|
||||||
listings.price,
|
listings.price,
|
||||||
listings.host_id,
|
listings.host_id,
|
||||||
hosts.host_name,
|
hosts.host_name,
|
||||||
|
|
|
||||||
|
|
@ -25,3 +25,7 @@ models:
|
||||||
'Hotel room'
|
'Hotel room'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
- name: minimum_nights
|
||||||
|
tests:
|
||||||
|
- positive_value
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
SELECT *
|
|
||||||
FROM
|
|
||||||
{{ ref('dim_listings_cleansed') }}
|
|
||||||
WHERE
|
|
||||||
mininum_nights < 1
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue