This commit is contained in:
Joaquin Ossa 2024-12-11 15:42:35 +01:00
parent c0e6ec2de8
commit a564afea3c
2 changed files with 64 additions and 44 deletions

View file

@ -1,50 +1,61 @@
{% set api_name = "CHECKINHEROAPI" %}
with with
stg_screen_and_protect__verification_requests as ( stg_screen_and_protect__verification_requests as (
select * from {{ ref("stg_screen_and_protect__verification_requests") }} select * from {{ ref("stg_screen_and_protect__verification_requests") }}
) ),
stg_core__apim_user as (select * from {{ ref("stg_core__apim_user") }}),
stg_core__apim_user_type as (select * from {{ ref("stg_core__apim_user_type") }})
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, vr.id_verification,
id_booking, vr.id_booking,
id_user_partner, vr.id_user_partner,
id_accommodation, vr.id_accommodation,
protection_type, ({{ adapter.quote("json_document_user_data") }} ->> 'FlaggedNotProtected')::boolean
protection_starting_level, as not_protected,
protection_basic_amount, vr.protection_type,
protection_extended_amount, vr.protection_starting_level,
pet_protection, vr.protection_basic_amount,
verification_status, vr.protection_extended_amount,
verification_status_reason, vr.pet_protection,
email_flag, vr.verification_status,
phone_flag, vr.verification_status_reason,
watch_list, vr.email_flag,
channel, vr.phone_flag,
checkin_date_utc, vr.watch_list,
checkout_date_utc, vr.channel,
checkout_date_utc - checkin_date_utc as number_of_nights, vr.checkin_date_utc,
is_cancelled, vr.checkout_date_utc,
cancelled_at_utc, vr.checkout_date_utc - checkin_date_utc as number_of_nights,
cancelled_date_utc, vr.is_cancelled,
user_email, vr.cancelled_at_utc,
guest_email, vr.cancelled_date_utc,
guest_last_name, vr.user_email,
guest_first_name, vr.guest_email,
guest_telephone, vr.guest_last_name,
company_name, vr.guest_first_name,
property_manager_name, vr.guest_telephone,
property_manager_email, vr.company_name,
listing_name, vr.property_manager_name,
listing_address, vr.property_manager_email,
listing_town, vr.listing_name,
listing_country, vr.listing_address,
listing_postcode, vr.listing_town,
pets_allowed, vr.listing_country,
status_updated_at_utc, vr.listing_postcode,
status_updated_date_utc, vr.pets_allowed,
updated_at_utc, vr.status_updated_at_utc,
updated_date_utc, vr.status_updated_date_utc,
cosmos_creation_at_utc, vr.updated_at_utc,
cosmos_creation_date_utc, vr.updated_date_utc,
created_date_utc vr.cosmos_creation_at_utc,
from stg_screen_and_protect__verification_requests vr.cosmos_creation_date_utc,
vr.created_date_utc
from stg_screen_and_protect__verification_requests vr
inner join stg_core__apim_user au on vr.id_user_partner = au.id_apim_user
inner join
stg_core__apim_user_type aut
on au.id_apim_user_type = aut.id_apim_user_type
and upper(aut.user_type_name) = '{{ api_name }}'

View file

@ -30,6 +30,15 @@ models:
data_type: text data_type: text
description: Identifier for the accommodation related to the booking. description: Identifier for the accommodation related to the booking.
- name: not_protected
data_type: boolean
description: |
Indicates if the booking is protected or not.
It is kind of weird for being a negative statement,
so when false it means the booking is protected.
tests:
- not_null
- name: protection_type - name: protection_type
data_type: text data_type: text
description: Specific protection type for the request. description: Specific protection type for the request.