Merged PR 2275: Created model int_core__verification_request_booking_source to have easier ac...
Created model int_core__verification_request_booking_source to have easier access to host category type in different models Related work items: #17200
This commit is contained in:
commit
725dadd0a3
4 changed files with 457 additions and 1 deletions
|
|
@ -12,6 +12,9 @@ with
|
|||
),
|
||||
int_core__booking_charge_events as (
|
||||
select * from {{ ref("int_core__booking_charge_events") }}
|
||||
),
|
||||
int_core__verification_request_booking_source as (
|
||||
select * from {{ ref("int_core__verification_request_booking_source") }}
|
||||
)
|
||||
select
|
||||
b.id_booking,
|
||||
|
|
@ -21,6 +24,7 @@ select
|
|||
b.id_accommodation,
|
||||
b.id_booking_source,
|
||||
b.id_verification_request,
|
||||
vrbs.verification_request_booking_source,
|
||||
b.id_staging_host_booking,
|
||||
db.is_duplicate_booking,
|
||||
db.is_duplicating_booking_with_id,
|
||||
|
|
@ -50,3 +54,6 @@ from stg_core__booking b
|
|||
left join stg_core__booking_state bs on b.id_booking_state = bs.id_booking_state
|
||||
left join int_core__duplicate_bookings db on b.id_booking = db.id_booking
|
||||
left join int_core__booking_charge_events bce on b.id_booking = bce.id_booking
|
||||
left join
|
||||
int_core__verification_request_booking_source vrbs
|
||||
on vrbs.id_verification_request = b.id_verification_request
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
with
|
||||
stg_core__booking as (select * from {{ ref("stg_core__booking") }}),
|
||||
stg_core__verification_request as (
|
||||
select * from {{ ref("stg_core__verification_request") }}
|
||||
)
|
||||
select distinct
|
||||
vr.id_verification_request,
|
||||
vr.created_at_utc,
|
||||
vr.created_date_utc,
|
||||
case
|
||||
when b.id_integration is not null
|
||||
then 'PMS'
|
||||
when vr.id_one_step_link is not null
|
||||
then 'OSL'
|
||||
else 'API/MANUAL'
|
||||
-- At this point we can't differentiate between these 2 categories so for
|
||||
-- now we keep them together
|
||||
end as verification_request_booking_source
|
||||
from stg_core__verification_request vr
|
||||
left join stg_core__booking b on b.id_verification_request = vr.id_verification_request
|
||||
|
|
@ -8,6 +8,9 @@ with
|
|||
),
|
||||
int_core__verification_request_completed_date as (
|
||||
select * from {{ ref("int_core__verification_request_completed_date") }}
|
||||
),
|
||||
int_core__verification_request_booking_source as (
|
||||
select * from {{ ref("int_core__verification_request_booking_source") }}
|
||||
)
|
||||
select
|
||||
vr.id_verification_request,
|
||||
|
|
@ -39,6 +42,7 @@ select
|
|||
vr.is_deleted,
|
||||
vr.redirect_name,
|
||||
vr.id_one_step_link,
|
||||
vrbs.verification_request_booking_source,
|
||||
vr.success_message,
|
||||
vr.summary,
|
||||
vr.rejection_reason,
|
||||
|
|
@ -58,3 +62,6 @@ left join
|
|||
left join
|
||||
int_core__verification_request_completed_date vrcd
|
||||
on vr.id_verification_request = vrcd.id_verification_request
|
||||
left join
|
||||
int_core__verification_request_booking_source vrbs
|
||||
on vrbs.id_verification_request = vr.id_verification_request
|
||||
|
|
|
|||
|
|
@ -942,4 +942,426 @@ models:
|
|||
- name: has_fee_payment
|
||||
data_type: boolean
|
||||
description: |
|
||||
True if guest payed the fee
|
||||
True if guest payed the fee
|
||||
|
||||
|
||||
- name: int_core__verification_request_booking_source
|
||||
description:
|
||||
This model contains information on verification requests
|
||||
and the category type of host that manages the associated
|
||||
booking.
|
||||
For PMS (Property Manager System) we use the id_integration
|
||||
from stg_core__booking, if it isn't Null then the host is PMS type.
|
||||
For OSL (One Step Link) we use the id_one_step_link from
|
||||
stg_core__verification_request, similarly if it isn't Null then
|
||||
the host is OSL type.
|
||||
Finally if both id_integration and id_one_step_link are Null,
|
||||
then we classify them as API/MANUAL. (At this point we can't
|
||||
differentiate between these 2 categories so for now we keep
|
||||
them together)
|
||||
|
||||
columns:
|
||||
- name: id_verification_request
|
||||
data_type: bigint
|
||||
description:
|
||||
Id value for the verification request, there can be more
|
||||
than 1 record for each verification request since they can
|
||||
be associated to more than 1 booking
|
||||
tests:
|
||||
- not_null
|
||||
- unique
|
||||
|
||||
- name: created_at_utc
|
||||
data_type: timestamp without time zone
|
||||
description:
|
||||
Date and time of creation of the verification request
|
||||
|
||||
- name: created_date_utc
|
||||
data_type: date
|
||||
description:
|
||||
Date of creation of the verification request
|
||||
|
||||
- name: verification_request_booking_source
|
||||
data_type: text
|
||||
description:
|
||||
Source type of host of the booking, this could be either;
|
||||
- PMS
|
||||
- OSL
|
||||
- API/MANUAL
|
||||
tests:
|
||||
- not_null
|
||||
- accepted_values:
|
||||
values:
|
||||
- 'PMS'
|
||||
- 'OSL'
|
||||
- 'API/MANUAL'
|
||||
|
||||
- name: int_core__verification_requests
|
||||
description:
|
||||
This is a table that shows all guest journey from our guests users with
|
||||
each record matching each guest journey.
|
||||
|
||||
It holds information about the guests like name, email, phone, etc.., as
|
||||
well as dates regarding the process of the guest journey like when it
|
||||
was started or finished.
|
||||
columns:
|
||||
- name: id_verification_request
|
||||
data_type: bigint
|
||||
description:
|
||||
Unique, incremental, internal ID for the related verification
|
||||
request.
|
||||
|
||||
- name: uuid_verification_request
|
||||
data_type: text
|
||||
description: uuid for the related verification request.
|
||||
|
||||
- name: id_verification_set
|
||||
data_type: bigint
|
||||
description: ""
|
||||
|
||||
- name: id_superhog_verified_set
|
||||
data_type: bigint
|
||||
description: ""
|
||||
|
||||
- name: id_payment_validation_set
|
||||
data_type: bigint
|
||||
description: ""
|
||||
|
||||
- name: id_user_guest
|
||||
data_type: character varying
|
||||
description: Unique, incremental, internal ID for the guest user.
|
||||
|
||||
- name: id_user_host
|
||||
data_type: character varying
|
||||
description: Unique, incremental, internal ID for the host user.
|
||||
|
||||
- name: is_verification_request_complete
|
||||
data_type: boolean
|
||||
description: True if the verification request is considered
|
||||
complete, AKA the guest has finished the full guest journey.
|
||||
|
||||
- name: verification_url
|
||||
data_type: character varying
|
||||
description: ""
|
||||
|
||||
- name: callback_url
|
||||
data_type: character varying
|
||||
description: ""
|
||||
|
||||
- name: redirect_url
|
||||
data_type: character varying
|
||||
description: ""
|
||||
|
||||
- name: logo
|
||||
data_type: character varying
|
||||
description: ""
|
||||
|
||||
- name: guest_email
|
||||
data_type: character varying
|
||||
description: The email of the guest.
|
||||
|
||||
- name: last_name
|
||||
data_type: character varying
|
||||
description: The last name of the guest.
|
||||
|
||||
- name: first_name
|
||||
data_type: character varying
|
||||
description: The first name of the guest.
|
||||
|
||||
- name: guest_phone_number
|
||||
data_type: character varying
|
||||
description: The phone number of the guest.
|
||||
|
||||
- name: telephone_code
|
||||
data_type: character varying
|
||||
description: The telephone code of the guest.
|
||||
|
||||
- name: guest_phone_number_2
|
||||
data_type: character varying
|
||||
description: ""
|
||||
|
||||
- name: verification_estimated_started_at_utc
|
||||
data_type: timestamp without time zone
|
||||
description:
|
||||
The estimated date and time at which the guest started the guest journey.
|
||||
|
||||
- name: verification_estimated_started_date_utc
|
||||
data_type: date
|
||||
description:
|
||||
The estimated date on which the guest started the guest journey.
|
||||
|
||||
- name: verification_estimated_completed_at_utc
|
||||
data_type: timestamp without time zone
|
||||
description:
|
||||
The estimated date and time at which the guest finished the guest journey.
|
||||
|
||||
- name: verification_estimated_completed_date_utc
|
||||
data_type: date
|
||||
description:
|
||||
The estimated date on which the guest finished the guest journey.
|
||||
|
||||
- name: link_used_at_utc
|
||||
data_type: timestamp without time zone
|
||||
description:
|
||||
The date and time at which the guest used the link for the verification.
|
||||
|
||||
- name: link_used_date_utc
|
||||
data_type: date
|
||||
description:
|
||||
The date on which the guest used the link for the verification.
|
||||
|
||||
- name: expire_at_utc
|
||||
data_type: timestamp without time zone
|
||||
description:
|
||||
The date and time at which the link for the verification expires.
|
||||
|
||||
- name: expire_date_utc
|
||||
data_type: date
|
||||
description:
|
||||
The date on which the link for the verification expires.
|
||||
|
||||
- name: is_deleted
|
||||
data_type: boolean
|
||||
description: |
|
||||
True if the link for verification expired before finishing the
|
||||
verification.
|
||||
|
||||
- name: redirect_name
|
||||
data_type: character varying
|
||||
description: ""
|
||||
|
||||
- name: id_one_step_link
|
||||
data_type: bigint
|
||||
description: ""
|
||||
|
||||
- name: verification_request_booking_source
|
||||
data_type: text
|
||||
description:
|
||||
Source type of host of the booking, this could be either;
|
||||
- PMS
|
||||
- OSL
|
||||
- API/MANUAL
|
||||
tests:
|
||||
- not_null
|
||||
- accepted_values:
|
||||
values:
|
||||
- 'PMS'
|
||||
- 'OSL'
|
||||
- 'API/MANUAL'
|
||||
|
||||
- name: success_message
|
||||
data_type: character varying
|
||||
description: ""
|
||||
|
||||
- name: summary
|
||||
data_type: character varying
|
||||
description: ""
|
||||
|
||||
- name: rejection_reason
|
||||
data_type: character varying
|
||||
description:
|
||||
Reason as to why the guest was rejected.
|
||||
|
||||
- name: has_switched_to_mobile
|
||||
data_type: boolean
|
||||
description: |
|
||||
True if the guest changed has switched to mobile
|
||||
during the verification process.
|
||||
|
||||
- name: is_verifier_rejected
|
||||
data_type: boolean
|
||||
description: ""
|
||||
|
||||
- name: config
|
||||
data_type: character varying
|
||||
description: ""
|
||||
|
||||
- name: metadata
|
||||
data_type: character varying
|
||||
description: ""
|
||||
|
||||
- name: created_at_utc
|
||||
data_type: timestamp without time zone
|
||||
description:
|
||||
The date and time at which the verification process was created.
|
||||
|
||||
- name: created_date_utc
|
||||
data_type: date
|
||||
description:
|
||||
The date on which the verification process was created.
|
||||
|
||||
- name: updated_at_utc
|
||||
data_type: timestamp without time zone
|
||||
description:
|
||||
The date and time at which the last update on the entry happened.
|
||||
|
||||
- name: updated_date_utc
|
||||
data_type: date
|
||||
description:
|
||||
The date on which the last update on the entry happened.
|
||||
|
||||
- name: dwh_extracted_at_utc
|
||||
data_type: timestamp with time zone
|
||||
description: ""
|
||||
|
||||
- name: int_core__bookings
|
||||
description: ""
|
||||
columns:
|
||||
- name: id_booking
|
||||
data_type: bigint
|
||||
description: "The unique, Superhog generated id for this booking."
|
||||
tests:
|
||||
- unique
|
||||
- not_null
|
||||
|
||||
- name: id_user_guest
|
||||
data_type: character varying
|
||||
description: "The unique, Superhog generated id for the guest"
|
||||
|
||||
- name: id_user_host
|
||||
data_type: character varying
|
||||
description: "The unique, Superhog generated id for the host"
|
||||
|
||||
- name: id_integration
|
||||
data_type: character varying
|
||||
description: ""
|
||||
|
||||
- name: id_accommodation
|
||||
data_type: bigint
|
||||
description: "The ID of the booked listing."
|
||||
|
||||
- name: id_booking_source
|
||||
data_type: bigint
|
||||
description: ""
|
||||
|
||||
- name: id_verification_request
|
||||
data_type: bigint
|
||||
description: "Id value for the verification request, there can be more than 1 record for each verification request since they can be associated to more than 1 booking"
|
||||
|
||||
- name: verification_request_booking_source
|
||||
data_type: text
|
||||
description:
|
||||
Source type of host of the booking, this could be either;
|
||||
- PMS
|
||||
- OSL
|
||||
- API/MANUAL
|
||||
tests:
|
||||
- not_null
|
||||
- accepted_values:
|
||||
values:
|
||||
- 'PMS'
|
||||
- 'OSL'
|
||||
- 'API/MANUAL'
|
||||
|
||||
- name: id_staging_host_booking
|
||||
data_type: bigint
|
||||
description: ""
|
||||
|
||||
- name: is_duplicate_booking
|
||||
data_type: boolean
|
||||
description:
|
||||
A flag that identifies whether the booking is a duplicate.
|
||||
|
||||
A booking is considered a duplicate if there's an older booking with the same user,
|
||||
accomodation and check-in date. If there are two or more bookings with the same user,
|
||||
accomodation and check-in date, the oldest one will have False as a value in this field,
|
||||
and the other ones will have True as a value in this Failed."
|
||||
|
||||
Put simply, if you don't want to receive duplicates, filter this field to True.
|
||||
|
||||
- name: is_duplicating_booking_with_id
|
||||
data_type: bigint
|
||||
description:
|
||||
"If is_duplicate_booking is True then gives id_booking"
|
||||
|
||||
- name: booking_state
|
||||
data_type: character varying
|
||||
description: ""
|
||||
|
||||
- name: check_in_at_utc
|
||||
data_type: timestamp without time zone
|
||||
description: ""
|
||||
|
||||
- name: check_in_date_utc
|
||||
data_type: date
|
||||
description: ""
|
||||
|
||||
- name: check_out_at_utc
|
||||
data_type: timestamp without time zone
|
||||
description: ""
|
||||
|
||||
- name: check_out_date_utc
|
||||
data_type: date
|
||||
description: ""
|
||||
|
||||
- name: check_in_sits_in_future
|
||||
data_type: boolean
|
||||
description: ""
|
||||
|
||||
- name: check_out_sits_in_future
|
||||
data_type: boolean
|
||||
description: ""
|
||||
|
||||
- name: booking_fee_local
|
||||
data_type: numeric
|
||||
description: "The fee to apply to the booking, in host currency."
|
||||
|
||||
- name: booking_fee_charge_at_utc
|
||||
data_type: timestamp without time zone
|
||||
description: The point in time in which the booking should be invoiced.
|
||||
This could be the check-in date of the booking or the date in which the guest verification
|
||||
started, depending on the billing settings of the host.
|
||||
|
||||
- name: booking_fee_charge_date_utc
|
||||
data_type: date
|
||||
description: The date in which the booking should be invoiced.
|
||||
This could be the check-in date of the booking or the date in which the guest verification
|
||||
started, depending on the billing settings of the host.
|
||||
|
||||
- name: summary
|
||||
data_type: character varying
|
||||
description: ""
|
||||
|
||||
- name: guest_email
|
||||
data_type: character varying
|
||||
description: ""
|
||||
|
||||
- name: guest_last_name
|
||||
data_type: character varying
|
||||
description: ""
|
||||
|
||||
- name: guest_first_name
|
||||
data_type: character varying
|
||||
description: ""
|
||||
|
||||
- name: guest_telephone
|
||||
data_type: character varying
|
||||
description: ""
|
||||
|
||||
- name: additional_guests
|
||||
data_type: character varying
|
||||
description: ""
|
||||
|
||||
- name: unsubscribe_verification_reminder
|
||||
data_type: boolean
|
||||
description: ""
|
||||
|
||||
- name: created_at_utc
|
||||
data_type: timestamp without time zone
|
||||
description: "Date and time of creation of the verification request"
|
||||
|
||||
- name: created_date_utc
|
||||
data_type: date
|
||||
description: "Date of creation of the verification request"
|
||||
|
||||
- name: updated_at_utc
|
||||
data_type: timestamp without time zone
|
||||
description: ""
|
||||
|
||||
- name: updated_date_utc
|
||||
data_type: date
|
||||
description: ""
|
||||
|
||||
- name: dwh_extracted_at_utc
|
||||
data_type: timestamp with time zone
|
||||
description: ""
|
||||
Loading…
Add table
Add a link
Reference in a new issue