basic bookings and duplicates
This commit is contained in:
parent
09a62c701a
commit
d8cf15be4a
2 changed files with 96 additions and 0 deletions
40
models/intermediate/int_core__bookings.sql
Normal file
40
models/intermediate/int_core__bookings.sql
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
with
|
||||
stg_core__booking as (select * from {{ ref("stg_core__booking") }}),
|
||||
stg_core__booking_state as (select * from {{ ref("stg_core__booking_state") }}),
|
||||
int_core__duplicate_bookings as (
|
||||
select id_booking, is_duplicate_booking, is_duplicating_booking_with_id
|
||||
from {{ ref("int_core__duplicate_bookings") }}
|
||||
)
|
||||
|
||||
select
|
||||
b.id_booking,
|
||||
b.id_user_guest,
|
||||
b.id_user_host,
|
||||
b.id_integration,
|
||||
b.id_accommodation,
|
||||
b.id_booking_source,
|
||||
b.id_verification_request,
|
||||
b.id_staging_host_booking,
|
||||
db.is_duplicate_booking,
|
||||
db.is_duplicating_booking_with_id,
|
||||
bs.booking_state,
|
||||
b.check_in_at_utc,
|
||||
b.check_in_date_utc,
|
||||
b.check_out_at_utc,
|
||||
b.check_out_date_utc,
|
||||
b.summary,
|
||||
b.guest_email,
|
||||
b.guest_last_name,
|
||||
b.guest_first_name,
|
||||
b.guest_telephone,
|
||||
b.additional_guests,
|
||||
b.unsubscribe_verification_reminder,
|
||||
b.created_at_utc,
|
||||
b.created_date_utc,
|
||||
b.updated_at_utc,
|
||||
b.updated_date_utc,
|
||||
b.dwh_extracted_at_utc
|
||||
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 as db on b.id_booking = db.id_booking
|
||||
where b.updated_at_utc > '2024-01-01' and db.is_duplicate_booking is true
|
||||
Loading…
Add table
Add a link
Reference in a new issue