data-dwh-dbt-project/models/intermediate/core/int_edeposit__verifications.sql
2024-08-28 15:21:08 +02:00

42 lines
1,014 B
SQL

with
stg_edeposit__verifications as (
select * from {{ ref("stg_edeposit__verifications") }}
)
select
id as id_verification,
id_booking,
id_user,
id_listing,
version, -- V1 for guesty and V2 for e-deposit verifications
verification_status,
verification_status_reason,
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,
checkout_at_utc,
is_cancelled,
cancelled_at_utc,
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,
level_of_protection_amount,
level_of_protection_currency,
status_updated_at_utc,
updated_at_utc,
creation_at_utc,
created_at_utc
from stg_edeposit__verifications