Adding id_deal

This commit is contained in:
Joaquin 2025-03-18 12:06:25 +01:00
parent b518c536f2
commit a145a00b4d
5 changed files with 64 additions and 41 deletions

View file

@ -82,6 +82,7 @@ select
v.id_verification,
v.id_booking,
v.id_user_partner,
v.id_deal,
v.id_accommodation,
v.listing_town,
v.listing_country,

View file

@ -1,47 +1,50 @@
with
stg_edeposit__verifications as (
select * from {{ ref("stg_edeposit__verifications") }}
)
),
stg_core__user as (select * from {{ ref("stg_core__user") }})
select
-- note that these ids are not the same as the ones found in Core DWH
-- they are completely unrelated
id_verification,
id_booking,
id_user_partner,
id_accommodation,
version,
case when version = 'V2' then 'Edeposit' else null end as verification_source,
verification_status,
nightly_fee_local,
cast(checkout_at_utc as date) - cast(checkin_at_utc as date) as number_nights,
email_flag,
phone_flag,
watch_list,
channel,
checkin_at_utc,
cast(checkin_at_utc as date) as checkin_date_utc,
checkout_at_utc,
cast(checkout_at_utc as date) as checkout_date_utc,
is_cancelled,
cancelled_at_utc,
cast(cancelled_at_utc as date) as cancelled_date_utc,
user_email,
guest_email,
guest_last_name,
guest_first_name,
guest_telephone,
company_name,
listing_name,
listing_address,
listing_town,
listing_country,
listing_postcode,
pets_allowed,
status_updated_at_utc,
status_updated_date_utc,
updated_at_utc,
athena_creation_at_utc,
athena_creation_date_utc,
created_at_utc,
created_date_utc
from stg_edeposit__verifications
v.id_verification,
v.id_booking,
v.id_user_partner,
u.id_deal,
v.id_accommodation,
v.version,
case when v.version = 'V2' then 'Edeposit' else null end as verification_source,
v.verification_status,
v.nightly_fee_local,
cast(v.checkout_at_utc as date) - cast(v.checkin_at_utc as date) as number_nights,
v.email_flag,
v.phone_flag,
v.watch_list,
v.channel,
v.checkin_at_utc,
cast(v.checkin_at_utc as date) as checkin_date_utc,
v.checkout_at_utc,
cast(v.checkout_at_utc as date) as checkout_date_utc,
v.is_cancelled,
v.cancelled_at_utc,
cast(v.cancelled_at_utc as date) as cancelled_date_utc,
v.user_email,
v.guest_email,
v.guest_last_name,
v.guest_first_name,
v.guest_telephone,
v.company_name,
v.listing_name,
v.listing_address,
v.listing_town,
v.listing_country,
v.listing_postcode,
v.pets_allowed,
v.status_updated_at_utc,
v.status_updated_date_utc,
v.updated_at_utc,
v.athena_creation_at_utc,
v.athena_creation_date_utc,
v.created_at_utc,
v.created_date_utc
from stg_edeposit__verifications v
inner join stg_core__user u on u.email = v.user_email

View file

@ -31,6 +31,12 @@ models:
data_tests:
- not_null
- name: id_deal
data_type: text
description: "unique Superhog generated id for a deal"
data_tests:
- not_null
- name: id_accommodation
data_type: text
description: "unique Superhog generated id for a listing"
@ -224,6 +230,12 @@ models:
data_tests:
- not_null
- name: id_deal
data_type: text
description: "unique Superhog generated id for a deal"
data_tests:
- not_null
- name: id_accommodation
data_type: text
description: "unique Superhog generated id for a listing"

View file

@ -7,6 +7,7 @@ select
vf.id_verification as id_verification,
vf.id_booking as id_booking,
vf.id_user_partner as id_user_partner,
vf.id_deal as id_deal,
vf.id_accommodation as id_accommodation,
vf.listing_town as listing_town,
vf.listing_country as listing_country,

View file

@ -30,6 +30,12 @@ models:
data_tests:
- not_null
- name: id_deal
data_type: text
description: "unique Superhog generated id for a deal"
data_tests:
- not_null
- name: id_accommodation
data_type: text
description: "unique Superhog generated id for a listing"