Model for Bookings report in Legacy

This commit is contained in:
Joaquin Ossa 2025-02-05 11:53:28 +01:00
parent f76e49a75c
commit ff296ec75d
4 changed files with 492 additions and 0 deletions

View file

@ -0,0 +1,38 @@
with
int_core__bookings_details as (select * from {{ ref("int_core__booking_details") }})
select
id_booking as id_booking,
id_user_host as id_user_host,
id_deal as id_deal,
id_user_guest as id_user_guest,
id_accommodation as id_accommodation,
id_verification_request as id_verification_request,
booking_state as booking_state,
is_accommodation_active as is_accommodation_active,
checkin_date_utc as checkin_date_utc,
checkout_date_utc as checkout_date_utc,
booking_nights as booking_nights,
created_date_utc as created_date_utc,
host_first_name as host_first_name,
host_last_name as host_last_name,
host_email as host_email,
company_name as company_name,
guest_first_name as guest_first_name,
guest_last_name as guest_last_name,
guest_email as guest_email,
guest_billing_country as guest_billing_country,
guest_billing_town as guest_billing_town,
accommodation_country as accommodation_country,
accommodation_address as accommodation_address,
is_verification_request_complete as is_verification_request_complete,
verification_estimated_started_date_utc as verification_estimated_started_date_utc,
verification_estimated_completed_date_utc
as verification_estimated_completed_date_utc,
link_used_date_utc as link_used_date_utc,
verification_request_booking_source as verification_request_booking_source,
chose_deposit as chose_deposit,
chose_fee as chose_fee,
chose_waiver as chose_waiver,
chose_no_cover as chose_no_cover,
chose_checkin_cover as chose_checkin_cover
from int_core__bookings_details

View file

@ -1384,3 +1384,178 @@ models:
- name: total_bookings
data_type: bigint
description: "The total number of bookings for this accommodation."
- name: core__booking_details
description: |
"Contains detailed information about each booking, including host
and guest details, accommodation, and verification request data."
columns:
- name: id_booking
data_type: bigint
description: "The unique, Superhog generated id for this booking."
data_tests:
- unique
- not_null
- name: id_user_host
data_type: text
description: "The unique user ID for the Host."
data_tests:
- not_null
- name: id_deal
data_type: character varying
description:
"The ID of the deal of the user. It only applies to client accounts.
Can be null."
- name: id_user_guest
data_type: text
description: "The unique, Superhog generated id for the guest"
- name: id_accommodation
data_type: bigint
description: "Id of the accommodation or listing."
- name: id_verification_request
data_type: bigint
description: |
The identifier of the verification request. It acts as Foreign Key to
Verification Request table. It can be null.
- name: booking_state
data_type: character varying
description:
"State in which the booking is, could be either of the following:
- Approved
- NotApproved
- Cancelled
- Rejected
- NoFlags
- Flagged
- IncompleteInformation"
data_tests:
- accepted_values:
values:
- "Approved"
- "NotApproved"
- "Cancelled"
- "Rejected"
- "NoFlags"
- "Flagged"
- "IncompleteInformation"
- name: is_accommodation_active
data_type: boolean
description: "Boolean value indicating if the accommodation is active."
- name: checkin_date_utc
data_type: date
description: "Date of check-in of the booking."
- name: checkout_date_utc
data_type: date
description: "Date of check-out of the booking."
- name: booking_nights
data_type: integer
description: "Number of nights of the booking."
- name: created_date_utc
data_type: timestamp without time zone
description: "Date when the booking was created."
- name: host_first_name
data_type: character varying
description: "First name of the host."
- name: host_last_name
data_type: character varying
description: "Last name of the host."
- name: host_email
data_type: character varying
description: "Email of the host."
- name: company_name
data_type: character varying
description: "The company name."
- name: guest_first_name
data_type: character varying
description: "First name of the guest."
- name: guest_last_name
data_type: character varying
description: "Last name of the guest."
- name: guest_email
data_type: character varying
description: "Email of the guest."
- name: guest_billing_country
data_type: character varying
description: "Billing country of the guest."
- name: guest_billing_town
data_type: character varying
description: "Billing town of the guest."
- name: accommodation_country
data_type: character varying
description: "Country of the listing"
- name: accommodation_address
data_type: character varying
description: "Address of the listing"
- 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_estimated_started_date_utc
data_type: date
description: "The estimated date on which the guest started 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_date_utc
data_type: date
description: "The date on which the guest used the link for the verification."
- name: verification_request_booking_source
data_type: text
description: Source type of host of the booking, this could be either;
- PMS
- OSL
- API/MANUAL
data_tests:
- accepted_values:
values:
- "PMS"
- "OSL"
- "API/MANUAL"
- name: chose_deposit
data_type: boolean
description: "Boolean value indicating if the guest chose Deposit payment validation."
- name: chose_fee
data_type: boolean
description: "Boolean value indicating if the guest chose Fee payment validation."
- name: chose_waiver
data_type: boolean
description: "Boolean value indicating if the guest chose Waiver payment validation."
- name: chose_no_cover
data_type: boolean
description: "Boolean value indicating if the guest chose No Cover payment validation."
- name: chose_checkin_cover
data_type: boolean
description: "Boolean value indicating if the guest chose CheckIn Cover."