Merged PR 3740: Added missing values

# Description

Hardcoded the nigthly_fee for Guesty verifications and added some missing fields on the models.
There are some fields that are only `NULL` values for each of the verifications but I included them for the sake of the union

# Checklist

- [x] The edited models and dependants run properly with production data.
- [x] The edited models are sufficiently documented.
- [x] The edited models contain PK tests, and I've ran and passed them.
- [ ] I have checked for DRY opportunities with other models and docs.
- [ ] I've picked the right materialization for the affected models.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Added missing values

Related work items: #24825
This commit is contained in:
Joaquin Ossa 2024-12-03 11:11:17 +00:00
commit 7ef6fb3031
8 changed files with 46 additions and 34 deletions

View file

@ -1,3 +1,5 @@
{% set nightly_fee_local = 2 %}
with stg_athena__verifications as (select * from {{ ref("stg_athena__verifications") }})
select
-- note that these ids are not the same as the ones found in Core DWH
@ -9,7 +11,7 @@ select
version,
case when version = 'V1' then 'Guesty' else null end as verification_source,
verification_status,
nightly_fee_local,
{{ nightly_fee_local }} as nightly_fee_local,
cast(checkout_at_utc as date) - cast(checkin_at_utc as date) as number_nights,
email_flag,
phone_flag,
@ -27,13 +29,15 @@ select
guest_last_name,
guest_first_name,
guest_telephone,
company_name,
property_manager_name,
property_manager_email,
listing_name,
listing_address,
listing_town,
listing_country,
listing_postcode,
level_of_protection_amount,
level_of_protection_currency,
pets_allowed,
status_updated_at_utc,
status_updated_date_utc,

View file

@ -57,7 +57,7 @@ models:
- name: nightly_fee_local
data_type: double precision
description: "fee charged per night"
description: "fee in local currency charged per night"
- name: number_nights
data_type: integer
@ -127,10 +127,6 @@ models:
data_type: text
description: ""
- name: company_name
data_type: text
description: ""
- name: property_manager_name
data_type: text
description: ""
@ -143,6 +139,10 @@ models:
data_type: text
description: ""
- name: listing_address
data_type: text
description: ""
- name: listing_town
data_type: text
description: ""

View file

@ -13,7 +13,11 @@ select
av.verification_status,
av.nightly_fee_local,
av.number_nights,
av.nightly_fee_local * av.number_nights as total_fee_local,
case
when av.number_nights = 0
then av.nightly_fee_local
else av.nightly_fee_local * av.number_nights
end as total_fee_local,
av.email_flag,
av.phone_flag,
av.watch_list,
@ -30,13 +34,16 @@ select
av.guest_last_name,
av.guest_first_name,
av.guest_telephone,
av.company_name,
null as company_name,
av.property_manager_name,
av.property_manager_email,
av.listing_name,
av.listing_address,
av.listing_town,
av.listing_country,
av.listing_postcode,
av.level_of_protection_amount,
av.level_of_protection_currency,
av.pets_allowed,
av.status_updated_at_utc,
av.status_updated_date_utc,
@ -75,12 +82,15 @@ select
ev.guest_first_name,
ev.guest_telephone,
ev.company_name,
ev.property_manager_name,
ev.property_manager_email,
null as property_manager_name,
null as property_manager_email,
ev.listing_name,
ev.listing_address,
ev.listing_town,
ev.listing_country,
ev.listing_postcode,
null as level_of_protection_amount,
null as level_of_protection_currency,
ev.pets_allowed,
ev.status_updated_at_utc,
ev.status_updated_date_utc,

View file

@ -1240,7 +1240,7 @@ models:
- name: nightly_fee_local
data_type: double precision
description: "fee charged per night"
description: "fee in local currency charged per night"
- name: number_nights
data_type: integer
@ -1248,7 +1248,7 @@ models:
- name: total_fee_local
data_type: double precision
description: "total fee for the booking"
description: "total fee in local currency for the booking"
- name: email_flag
data_type: text
@ -1330,6 +1330,10 @@ models:
data_type: text
description: ""
- name: listing_address
data_type: text
description: ""
- name: listing_town
data_type: text
description: ""

View file

@ -31,9 +31,8 @@ select
guest_first_name,
guest_telephone,
company_name,
property_manager_name,
property_manager_email,
listing_name,
listing_address,
listing_town,
listing_country,
listing_postcode,

View file

@ -58,7 +58,7 @@ models:
- name: nightly_fee_local
data_type: double precision
description: "fee charged per night"
description: "fee in local currency charged per night"
- name: number_nights
data_type: integer
@ -132,18 +132,14 @@ models:
data_type: text
description: ""
- name: property_manager_name
data_type: text
description: ""
- name: property_manager_email
data_type: text
description: ""
- name: listing_name
data_type: text
description: ""
- name: listing_address
data_type: text
description: ""
- name: listing_town
data_type: text
description: ""
@ -160,14 +156,6 @@ models:
data_type: boolean
description: ""
- name: level_of_protection_amount
data_type: integer
description: ""
- name: level_of_protection_currency
data_type: text
description: ""
- name: status_updated_at_utc
data_type: timestamp without time zone
description: "Timestamp when status was last updated"

View file

@ -33,9 +33,12 @@ select
eav.property_manager_name as property_manager_name,
eav.property_manager_email as property_manager_email,
eav.listing_name as listing_name,
eav.listing_address as listing_address,
eav.listing_town as listing_town,
eav.listing_country as listing_country,
eav.listing_postcode as listing_postcode,
eav.level_of_protection_amount as level_of_protection_amount,
eav.level_of_protection_currency as level_of_protection_currency,
eav.pets_allowed as pets_allowed,
eav.status_updated_at_utc as status_updated_at_utc,
eav.status_updated_date_utc as status_updated_date_utc,

View file

@ -57,7 +57,7 @@ models:
- name: nightly_fee_local
data_type: double precision
description: "fee charged per night"
description: "fee in local currency charged per night"
- name: number_nights
data_type: integer
@ -65,7 +65,7 @@ models:
- name: total_fee_local
data_type: double precision
description: "total fee for the booking"
description: "total fee in local currency for the booking"
- name: email_flag
data_type: text
@ -147,6 +147,10 @@ models:
data_type: text
description: ""
- name: listing_address
data_type: text
description: ""
- name: listing_town
data_type: text
description: ""