wip
This commit is contained in:
parent
c0e6ec2de8
commit
a564afea3c
2 changed files with 64 additions and 44 deletions
|
|
@ -1,50 +1,61 @@
|
|||
{% set api_name = "CHECKINHEROAPI" %}
|
||||
|
||||
with
|
||||
stg_screen_and_protect__verification_requests as (
|
||||
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
|
||||
-- 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,
|
||||
protection_type,
|
||||
protection_starting_level,
|
||||
protection_basic_amount,
|
||||
protection_extended_amount,
|
||||
pet_protection,
|
||||
verification_status,
|
||||
verification_status_reason,
|
||||
email_flag,
|
||||
phone_flag,
|
||||
watch_list,
|
||||
channel,
|
||||
checkin_date_utc,
|
||||
checkout_date_utc,
|
||||
checkout_date_utc - checkin_date_utc as number_of_nights,
|
||||
is_cancelled,
|
||||
cancelled_at_utc,
|
||||
cancelled_date_utc,
|
||||
user_email,
|
||||
guest_email,
|
||||
guest_last_name,
|
||||
guest_first_name,
|
||||
guest_telephone,
|
||||
company_name,
|
||||
property_manager_name,
|
||||
property_manager_email,
|
||||
listing_name,
|
||||
listing_address,
|
||||
listing_town,
|
||||
listing_country,
|
||||
listing_postcode,
|
||||
pets_allowed,
|
||||
status_updated_at_utc,
|
||||
status_updated_date_utc,
|
||||
updated_at_utc,
|
||||
updated_date_utc,
|
||||
cosmos_creation_at_utc,
|
||||
cosmos_creation_date_utc,
|
||||
created_date_utc
|
||||
from stg_screen_and_protect__verification_requests
|
||||
vr.id_verification,
|
||||
vr.id_booking,
|
||||
vr.id_user_partner,
|
||||
vr.id_accommodation,
|
||||
({{ adapter.quote("json_document_user_data") }} ->> 'FlaggedNotProtected')::boolean
|
||||
as not_protected,
|
||||
vr.protection_type,
|
||||
vr.protection_starting_level,
|
||||
vr.protection_basic_amount,
|
||||
vr.protection_extended_amount,
|
||||
vr.pet_protection,
|
||||
vr.verification_status,
|
||||
vr.verification_status_reason,
|
||||
vr.email_flag,
|
||||
vr.phone_flag,
|
||||
vr.watch_list,
|
||||
vr.channel,
|
||||
vr.checkin_date_utc,
|
||||
vr.checkout_date_utc,
|
||||
vr.checkout_date_utc - checkin_date_utc as number_of_nights,
|
||||
vr.is_cancelled,
|
||||
vr.cancelled_at_utc,
|
||||
vr.cancelled_date_utc,
|
||||
vr.user_email,
|
||||
vr.guest_email,
|
||||
vr.guest_last_name,
|
||||
vr.guest_first_name,
|
||||
vr.guest_telephone,
|
||||
vr.company_name,
|
||||
vr.property_manager_name,
|
||||
vr.property_manager_email,
|
||||
vr.listing_name,
|
||||
vr.listing_address,
|
||||
vr.listing_town,
|
||||
vr.listing_country,
|
||||
vr.listing_postcode,
|
||||
vr.pets_allowed,
|
||||
vr.status_updated_at_utc,
|
||||
vr.status_updated_date_utc,
|
||||
vr.updated_at_utc,
|
||||
vr.updated_date_utc,
|
||||
vr.cosmos_creation_at_utc,
|
||||
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 }}'
|
||||
|
|
|
|||
|
|
@ -30,6 +30,15 @@ models:
|
|||
data_type: text
|
||||
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
|
||||
data_type: text
|
||||
description: Specific protection type for the request.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue