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__booking as (select * from {{ ref("stg_core__booking") }}),
|
||||||
stg_core__verification_request as (
|
stg_core__verification_request as (
|
||||||
select * from {{ ref("stg_core__verification_request") }}
|
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
|
select distinct
|
||||||
bs.id_verification_request as id_verification_request,
|
vr.id_verification_request,
|
||||||
bs.id_user_guest as id_user_guest,
|
vr.created_at_utc,
|
||||||
bs.created_at_utc as created_at_utc,
|
vr.created_date_utc,
|
||||||
bs.created_date_utc as created_date_utc,
|
case
|
||||||
bs.source as source
|
when b.id_integration is not null
|
||||||
from booking_source bs
|
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
|
- not_null
|
||||||
- unique
|
- unique
|
||||||
|
|
||||||
- name: id_user_guest
|
|
||||||
data_type: character varying
|
|
||||||
description: Id value for the guest
|
|
||||||
|
|
||||||
- name: created_at_utc
|
- name: created_at_utc
|
||||||
data_type: timestamp without time zone
|
data_type: timestamp without time zone
|
||||||
description:
|
description:
|
||||||
|
|
@ -985,7 +981,7 @@ models:
|
||||||
description:
|
description:
|
||||||
Date of creation of the verification request
|
Date of creation of the verification request
|
||||||
|
|
||||||
- name: source
|
- name: verification_request_booking_source
|
||||||
data_type: text
|
data_type: text
|
||||||
description:
|
description:
|
||||||
Source type of host of the booking, this could be either;
|
Source type of host of the booking, this could be either;
|
||||||
|
|
@ -993,6 +989,7 @@ models:
|
||||||
- OSL
|
- OSL
|
||||||
- API/MANUAL
|
- API/MANUAL
|
||||||
tests:
|
tests:
|
||||||
|
- not_null
|
||||||
- accepted_values:
|
- accepted_values:
|
||||||
values:
|
values:
|
||||||
- 'PMS'
|
- 'PMS'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue