Adding id_deal
This commit is contained in:
parent
b518c536f2
commit
a145a00b4d
5 changed files with 64 additions and 41 deletions
|
|
@ -82,6 +82,7 @@ select
|
||||||
v.id_verification,
|
v.id_verification,
|
||||||
v.id_booking,
|
v.id_booking,
|
||||||
v.id_user_partner,
|
v.id_user_partner,
|
||||||
|
v.id_deal,
|
||||||
v.id_accommodation,
|
v.id_accommodation,
|
||||||
v.listing_town,
|
v.listing_town,
|
||||||
v.listing_country,
|
v.listing_country,
|
||||||
|
|
|
||||||
|
|
@ -1,47 +1,50 @@
|
||||||
with
|
with
|
||||||
stg_edeposit__verifications as (
|
stg_edeposit__verifications as (
|
||||||
select * from {{ ref("stg_edeposit__verifications") }}
|
select * from {{ ref("stg_edeposit__verifications") }}
|
||||||
)
|
),
|
||||||
|
stg_core__user as (select * from {{ ref("stg_core__user") }})
|
||||||
select
|
select
|
||||||
-- note that these ids are not the same as the ones found in Core DWH
|
-- note that these ids are not the same as the ones found in Core DWH
|
||||||
-- they are completely unrelated
|
-- they are completely unrelated
|
||||||
id_verification,
|
v.id_verification,
|
||||||
id_booking,
|
v.id_booking,
|
||||||
id_user_partner,
|
v.id_user_partner,
|
||||||
id_accommodation,
|
u.id_deal,
|
||||||
version,
|
v.id_accommodation,
|
||||||
case when version = 'V2' then 'Edeposit' else null end as verification_source,
|
v.version,
|
||||||
verification_status,
|
case when v.version = 'V2' then 'Edeposit' else null end as verification_source,
|
||||||
nightly_fee_local,
|
v.verification_status,
|
||||||
cast(checkout_at_utc as date) - cast(checkin_at_utc as date) as number_nights,
|
v.nightly_fee_local,
|
||||||
email_flag,
|
cast(v.checkout_at_utc as date) - cast(v.checkin_at_utc as date) as number_nights,
|
||||||
phone_flag,
|
v.email_flag,
|
||||||
watch_list,
|
v.phone_flag,
|
||||||
channel,
|
v.watch_list,
|
||||||
checkin_at_utc,
|
v.channel,
|
||||||
cast(checkin_at_utc as date) as checkin_date_utc,
|
v.checkin_at_utc,
|
||||||
checkout_at_utc,
|
cast(v.checkin_at_utc as date) as checkin_date_utc,
|
||||||
cast(checkout_at_utc as date) as checkout_date_utc,
|
v.checkout_at_utc,
|
||||||
is_cancelled,
|
cast(v.checkout_at_utc as date) as checkout_date_utc,
|
||||||
cancelled_at_utc,
|
v.is_cancelled,
|
||||||
cast(cancelled_at_utc as date) as cancelled_date_utc,
|
v.cancelled_at_utc,
|
||||||
user_email,
|
cast(v.cancelled_at_utc as date) as cancelled_date_utc,
|
||||||
guest_email,
|
v.user_email,
|
||||||
guest_last_name,
|
v.guest_email,
|
||||||
guest_first_name,
|
v.guest_last_name,
|
||||||
guest_telephone,
|
v.guest_first_name,
|
||||||
company_name,
|
v.guest_telephone,
|
||||||
listing_name,
|
v.company_name,
|
||||||
listing_address,
|
v.listing_name,
|
||||||
listing_town,
|
v.listing_address,
|
||||||
listing_country,
|
v.listing_town,
|
||||||
listing_postcode,
|
v.listing_country,
|
||||||
pets_allowed,
|
v.listing_postcode,
|
||||||
status_updated_at_utc,
|
v.pets_allowed,
|
||||||
status_updated_date_utc,
|
v.status_updated_at_utc,
|
||||||
updated_at_utc,
|
v.status_updated_date_utc,
|
||||||
athena_creation_at_utc,
|
v.updated_at_utc,
|
||||||
athena_creation_date_utc,
|
v.athena_creation_at_utc,
|
||||||
created_at_utc,
|
v.athena_creation_date_utc,
|
||||||
created_date_utc
|
v.created_at_utc,
|
||||||
from stg_edeposit__verifications
|
v.created_date_utc
|
||||||
|
from stg_edeposit__verifications v
|
||||||
|
inner join stg_core__user u on u.email = v.user_email
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,12 @@ models:
|
||||||
data_tests:
|
data_tests:
|
||||||
- not_null
|
- not_null
|
||||||
|
|
||||||
|
- name: id_deal
|
||||||
|
data_type: text
|
||||||
|
description: "unique Superhog generated id for a deal"
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
- name: id_accommodation
|
- name: id_accommodation
|
||||||
data_type: text
|
data_type: text
|
||||||
description: "unique Superhog generated id for a listing"
|
description: "unique Superhog generated id for a listing"
|
||||||
|
|
@ -224,6 +230,12 @@ models:
|
||||||
data_tests:
|
data_tests:
|
||||||
- not_null
|
- not_null
|
||||||
|
|
||||||
|
- name: id_deal
|
||||||
|
data_type: text
|
||||||
|
description: "unique Superhog generated id for a deal"
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
- name: id_accommodation
|
- name: id_accommodation
|
||||||
data_type: text
|
data_type: text
|
||||||
description: "unique Superhog generated id for a listing"
|
description: "unique Superhog generated id for a listing"
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ select
|
||||||
vf.id_verification as id_verification,
|
vf.id_verification as id_verification,
|
||||||
vf.id_booking as id_booking,
|
vf.id_booking as id_booking,
|
||||||
vf.id_user_partner as id_user_partner,
|
vf.id_user_partner as id_user_partner,
|
||||||
|
vf.id_deal as id_deal,
|
||||||
vf.id_accommodation as id_accommodation,
|
vf.id_accommodation as id_accommodation,
|
||||||
vf.listing_town as listing_town,
|
vf.listing_town as listing_town,
|
||||||
vf.listing_country as listing_country,
|
vf.listing_country as listing_country,
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,12 @@ models:
|
||||||
data_tests:
|
data_tests:
|
||||||
- not_null
|
- not_null
|
||||||
|
|
||||||
|
- name: id_deal
|
||||||
|
data_type: text
|
||||||
|
description: "unique Superhog generated id for a deal"
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
- name: id_accommodation
|
- name: id_accommodation
|
||||||
data_type: text
|
data_type: text
|
||||||
description: "unique Superhog generated id for a listing"
|
description: "unique Superhog generated id for a listing"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue