Removed guests_id and modified query structure
This commit is contained in:
parent
00502b1597
commit
70c2c5f6bf
2 changed files with 17 additions and 32 deletions
|
|
@ -2,31 +2,19 @@ with
|
|||
stg_core__booking as (select * from {{ ref("stg_core__booking") }}),
|
||||
stg_core__verification_request as (
|
||||
select * from {{ ref("stg_core__verification_request") }}
|
||||
),
|
||||
booking_source as (
|
||||
select distinct
|
||||
vr.id_verification_request,
|
||||
vr.id_user_guest,
|
||||
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 source
|
||||
from stg_core__verification_request vr
|
||||
left join
|
||||
stg_core__booking b
|
||||
on b.id_verification_request = vr.id_verification_request
|
||||
)
|
||||
select
|
||||
bs.id_verification_request as id_verification_request,
|
||||
bs.id_user_guest as id_user_guest,
|
||||
bs.created_at_utc as created_at_utc,
|
||||
bs.created_date_utc as created_date_utc,
|
||||
bs.source as source
|
||||
from booking_source bs
|
||||
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
|
||||
|
|
|
|||
|
|
@ -971,10 +971,6 @@ models:
|
|||
- not_null
|
||||
- unique
|
||||
|
||||
- name: id_user_guest
|
||||
data_type: character varying
|
||||
description: Id value for the guest
|
||||
|
||||
- name: created_at_utc
|
||||
data_type: timestamp without time zone
|
||||
description:
|
||||
|
|
@ -985,7 +981,7 @@ models:
|
|||
description:
|
||||
Date of creation of the verification request
|
||||
|
||||
- name: source
|
||||
- name: verification_request_booking_source
|
||||
data_type: text
|
||||
description:
|
||||
Source type of host of the booking, this could be either;
|
||||
|
|
@ -993,6 +989,7 @@ models:
|
|||
- OSL
|
||||
- API/MANUAL
|
||||
tests:
|
||||
- not_null
|
||||
- accepted_values:
|
||||
values:
|
||||
- 'PMS'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue