data-dwh-dbt-project/models/intermediate/edeposit/int_edeposit__verifications.sql

49 lines
1.3 KiB
MySQL
Raw Normal View History

2024-08-27 14:55:29 +02:00
with
stg_edeposit__verifications as (
select * from {{ ref("stg_edeposit__verifications") }}
)
select
-- note that these ids are not the same as the ones found in Core DWH
-- they are completely unrelated
id_verification,
2024-08-28 09:58:14 +02:00
id_booking,
id_user_partner,
id_accommodation,
version,
2024-10-04 17:44:26 +02:00
case when version = 'V2' then 'Edeposit' else null end as verification_source,
2024-08-28 09:58:14 +02:00
verification_status,
nightly_fee_local,
2024-08-28 09:58:14 +02:00
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,
2024-08-28 09:58:14 +02:00
checkout_at_utc,
cast(checkout_at_utc as date) as checkout_date_utc,
2024-08-28 09:58:14 +02:00
is_cancelled,
cancelled_at_utc,
2024-09-02 11:16:51 +02:00
cast(cancelled_at_utc as date) as cancelled_date_utc,
2024-08-28 09:58:14 +02:00
user_email,
guest_email,
guest_last_name,
guest_first_name,
guest_telephone,
company_name,
property_manager_name,
property_manager_email,
listing_name,
listing_town,
listing_country,
listing_postcode,
pets_allowed,
status_updated_at_utc,
2024-09-03 18:03:19 +02:00
status_updated_date_utc,
2024-08-28 09:58:14 +02:00
updated_at_utc,
2024-09-03 18:03:19 +02:00
athena_creation_at_utc,
2024-09-04 09:12:21 +02:00
athena_creation_date_utc,
2024-09-02 11:16:51 +02:00
created_at_utc,
2024-09-03 18:03:19 +02:00
created_date_utc
2024-08-28 09:58:14 +02:00
from stg_edeposit__verifications