From d33e5ff2b20c1cf1f87434e96e032330575b6b77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oriol=20Roqu=C3=A9=20Paniagua?= Date: Fri, 30 May 2025 12:51:10 +0000 Subject: [PATCH] Merged PR 5353: Switch int_core__booking_summary to int_booking_summary # Description This PR does the following: * Moves `core/int_core__booking_summary` to `cross/int_core__booking_summary` * Renames the model `cross/int_core__booking_summary` to `cross/int_booking_summary` * Same for schema entry. In the new schema, I just added in the description how to retrieve exclusively New Dash Bookings for usability purposes. Then, it adapts any dependency on `int_core__booking_summary` to `int_booking_summary` No additional changes - inclusion of Resolution Incidents data will come later in a different PR. # Checklist - [X] The edited models and dependants run properly with production data. - [X] The edited models are sufficiently documented. - [X] The edited models contain PK tests, and I've ran and passed them. - [X] I have checked for DRY opportunities with other models and docs. - [X] I've picked the right materialization for the affected models. # Other - [ ] Check if a full-refresh is required after this PR is merged. Related work items: #30676 --- models/intermediate/core/schema.yml | 375 ----------------- .../int_booking_summary.sql} | 0 .../int_flagging_booking_categorisation.sql | 4 +- .../cross/int_new_dash_deal_onboarding.sql | 4 +- models/intermediate/cross/schema.yml | 381 ++++++++++++++++++ ...t_kpis__metric_daily_billable_bookings.sql | 4 +- ..._kpis__metric_daily_check_out_bookings.sql | 2 +- ..._metric_daily_completed_guest_journeys.sql | 2 +- ...nt_kpis__metric_daily_created_bookings.sql | 2 +- ...s__metric_daily_created_guest_journeys.sql | 2 +- ...tric_daily_guest_journeys_with_payment.sql | 2 +- .../int_kpis__metric_daily_guest_payments.sql | 2 +- ...ric_daily_new_dash_chargeable_services.sql | 2 +- ...metric_daily_new_dash_created_bookings.sql | 2 +- ...metric_daily_new_dash_created_services.sql | 2 +- ...s__metric_daily_started_guest_journeys.sql | 2 +- .../general/new_dash_booking_summary.sql | 4 +- 17 files changed, 399 insertions(+), 393 deletions(-) rename models/intermediate/{core/int_core__booking_summary.sql => cross/int_booking_summary.sql} (100%) diff --git a/models/intermediate/core/schema.yml b/models/intermediate/core/schema.yml index 6195d9d..439168e 100644 --- a/models/intermediate/core/schema.yml +++ b/models/intermediate/core/schema.yml @@ -3801,381 +3801,6 @@ models: fields will contain different dates. It can be null, thus meaning there's no chargeable date at all. - - name: int_core__booking_summary - description: | - This model contains enriched information aggregated at Booking level regarding - the services that are applied within a Booking. - Specifically, contains both Booking and Services attributes (aggregated), as well - as the total price in GBP at this specific moment in time. In other words, - it's the snapshot of the current status of the Booking. - It's a subset of all bookings since it only applies to bookings that come from - hosts that have been migrated into the New Dash or New Pricing. - data_tests: - - dbt_expectations.expect_column_pair_values_A_to_be_greater_than_B: - column_A: booking_check_out_at_utc - column_B: booking_check_in_at_utc - or_equal: True - - dbt_expectations.expect_column_pair_values_A_to_be_greater_than_B: - column_A: number_of_applied_services - column_B: number_of_applied_paid_services - or_equal: True - - dbt_expectations.expect_column_pair_values_A_to_be_greater_than_B: - column_A: number_of_applied_services - column_B: number_of_applied_upgraded_services - or_equal: True - - columns: - - name: id_booking - data_type: bigint - description: | - The identifier of the booking. Acts as Primary Key to this table. - Cannot be null. - data_tests: - - not_null - - unique - - - 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: id_accommodation - data_type: bigint - description: - The identifier of the accommodation or listing. It acts as Foreign Key - to the Accommodation table. It cannot be null. - data_tests: - - not_null - - - name: id_user_product_bundle - data_type: bigint - description: - The identifier of the Product Bundle, or program, that a User has applied - to the Booking. It acts as Foreign Key to the User Product Bundle table. - It cannot be null. - data_tests: - - not_null - - - name: id_deal - data_type: string - description: | - Unique identifier of the account. It can be null. - - - name: id_user_host - data_type: string - description: | - Unique identifier of the user that acts as a Host. Cannot be null. - data_tests: - - not_null - - - name: id_user_guest - data_type: string - description: | - Unique identifier of the user that acts as a Guest. - Can be null if Superhog does not interact with the Guest. - - - name: booking_status - data_type: string - description: | - The current status of the booking. Cannot be null. - data_tests: - - not_null - - - name: program_name - data_type: string - description: | - The name of the program, or product bundle, applied to the booking. - Cannot be null. - data_tests: - - not_null - - - name: booking_created_at_utc - data_type: timestamp - description: | - Timestamp of when the Booking record was created in the Backend. - Cannot be null. - data_tests: - - not_null - - - name: booking_created_date_utc - data_type: date - description: | - Date of when the Booking record was created in the Backend. - Cannot be null. - data_tests: - - not_null - - - name: booking_updated_at_utc - data_type: timestamp - description: | - Timestamp of when the Booking record was last updated in the Backend. - Cannot be null. - data_tests: - - not_null - - - name: booking_updated_date_utc - data_type: date - description: | - Date of when the Booking record was last updated in the Backend. - Cannot be null. - data_tests: - - not_null - - - name: booking_check_in_at_utc - data_type: timestamp - description: | - Timestamp of the Check-in of the Booking. - Cannot be null. - data_tests: - - not_null - - - name: booking_check_in_date_utc - data_type: timestamp - description: | - Date of the Check-in of the Booking. - Cannot be null. - data_tests: - - not_null - - - name: booking_check_out_at_utc - data_type: timestamp - description: | - Timestamp of the Check-out of the Booking. - Cannot be null. - data_tests: - - not_null - - - name: booking_check_out_date_utc - data_type: date - description: | - Date of the Check-out of the Booking. - data_tests: - - not_null - - - name: booking_number_of_nights - data_type: integer - description: | - Number of nights between Check-in date and Check-out date. - - - name: host_currency_code - data_type: string - description: | - Iso 4217 currency code for the account of the Host. - It can be null. - - - name: is_user_in_new_dash - data_type: boolean - description: | - Flag to determine if this user host is in New Dash or not. - data_tests: - - not_null - - - name: new_dash_version - data_type: string - description: | - For users that are in New Dash, specifies the New Dash Version - in which these users were moved or joined. It can be null if - the user is not in new dash. - - - name: user_in_new_dash_since_timestamp_at_utc - data_type: timestamp - description: | - For users that are in New Dash, the effective date since - these users can be considered in New Dash. If the user - has moved from Old Dash, it will be the new_dash_move_at_utc. - If not, it will correspond to the joined_at_utc. It can be null - if the user is not in new dash. - - - name: booking_total_price_in_gbp - data_type: decimal - description: | - Identifies the current total price of the booking by adding up the - prices of each service applied to this booking, converted in GBP. - Can be null. Can vary over time depending on the service status, - payments, etc, as well as it can vary over time until the chargeable - date due to the currency rate estimation in the future. - - - name: service_first_chargeable_date_utc - data_type: date - description: | - Identifies the first moment in time in which the first - service applied to this booking is supposed to be charged. - - - name: service_last_chargeable_date_utc - data_type: date - description: | - Identifies the last moment in time in which the last - service applied to this booking is supposed to be charged. - - - name: service_first_billable_date_utc - data_type: date - description: | - Identifies the first moment in time in which the first - service applied to this booking is supposed to be billed. - This excludes Guest Payments, and only includes services to - be invoiced to the Host. - - - name: service_last_billable_date_utc - data_type: date - description: | - Identifies the last moment in time in which the last - service applied to this booking is supposed to be billed. - This excludes Guest Payments, and only includes services to - be invoiced to the Host. - - - name: service_first_created_at_utc - data_type: timestamp - description: | - Timestamp corresponding to the first creation of a Service - record applied to this Booking, according to the Backend. - data_tests: - - not_null - - - name: service_last_created_at_utc - data_type: timestamp - description: | - Timestamp corresponding to the latest creation of a Service - record applied to this Booking, according to the Backend. - data_tests: - - not_null - - - name: service_last_updated_at_utc - data_type: timestamp - description: | - Timestamp corresponding to the latest update on any Service - record applied to this Booking, according to the Backend. - data_tests: - - not_null - - - name: number_of_applied_services - data_type: integer - description: | - Total number of Services applied to this Booking. - - - name: number_of_applied_paid_services - data_type: integer - description: | - Total number of Services that require a monetary - income to Superhog applied to this Booking. - - - name: number_of_applied_upgraded_services - data_type: integer - description: | - Total number of Services different from Basic Screening - applied to this Booking. - - - name: number_of_applied_billable_services - data_type: integer - description: | - Total number of Services that require an invoice to the Host - to the Host, that are applied to this Booking. - - - name: is_booking_chargeable - data_type: boolean - description: | - Flag to identify it the Booking is chargeable or not. - In essence, it solves the question: are we supposed to get - money out of this booking, or not? - To be considered as chargeable, a chargeable date needs to exist - as well as the total price converted to GBP needs to be strictly - greater than 0. The fact that a booking is not chargeable does - not necessarily mean that it won't be in the future. Similarly, if - the booking is chargeable it does not necessarily mean that is actually - charged. It cannot be null. - data_tests: - - not_null - - - name: is_booking_billable - data_type: boolean - description: | - Flag to identify it the Booking is billable or not. - In essence, it solves the question: are we supposed to invoice - a certain amount to the host to get money out of this booking, or not? - To be considered as billable, a billable date needs to exist - as well as the total price of billable services, converted to GBP, - need to be strictly greater than 0. - The fact that a booking is not billable does not necessarily mean that - it won't be in the future. - The fact that a booking is not billable does not necessarily mean that - it's not chargeable, since Guest Payments could still apply. - Similarly, if the booking is billable it does not necessarily mean that - is actually billed. - It cannot be null. - data_tests: - - not_null - - - name: is_missing_currency_code_in_service_detail - data_type: boolean - description: | - Flag to identify if the currency code is missing in any - Booking Service Detail record for this Booking. - - - name: is_booking_cancelled - data_type: boolean - description: | - Flag to identify if the booking has been cancelled or not. - - - name: has_verification_request - data_type: boolean - description: | - Flag to identify if the booking has a verification request or not. - Cannot be null. - data_tests: - - not_null - - - name: has_paid_services - data_type: boolean - description: | - Flag to identify if the booking has any paid service or not. - - - name: has_upgraded_services - data_type: boolean - description: | - Flag to identify if the booking has any service different from - Basic Screening or not. - - - name: has_billable_services - data_type: boolean - description: | - Flag to identify if the booking has any billable service or not. - - - name: has_screening_service_business_type - data_type: boolean - description: | - Flag to identify if the booking contains any Screening service - or not. - - - name: has_upgraded_screening_service_business_type - data_type: boolean - description: | - Flag to identify if the booking contains any Screening services - different from Basic Screening. - - - name: has_deposit_management_service_business_type - data_type: boolean - description: | - Flag to identify if the booking contains any Deposit - Management service or not. - - - name: has_protection_service_business_type - data_type: boolean - description: | - Flag to identify if the booking contains any Protection - service or not. - - - name: is_missing_id_deal - data_type: boolean - description: | - Flag to identify if the Host for this booking is missing - the Id Deal or not. - - - name: is_missing_host_currency_code - data_type: boolean - description: | - Flag to identify if the Host for this booking is missing - the currency code or not. - - name: int_core__product_service_billing_item description: | Provides the Billing Items for Product Services in the scope of diff --git a/models/intermediate/core/int_core__booking_summary.sql b/models/intermediate/cross/int_booking_summary.sql similarity index 100% rename from models/intermediate/core/int_core__booking_summary.sql rename to models/intermediate/cross/int_booking_summary.sql diff --git a/models/intermediate/cross/int_flagging_booking_categorisation.sql b/models/intermediate/cross/int_flagging_booking_categorisation.sql index 39757fb..b8b31d0 100644 --- a/models/intermediate/cross/int_flagging_booking_categorisation.sql +++ b/models/intermediate/cross/int_flagging_booking_categorisation.sql @@ -18,7 +18,7 @@ {{ config(materialized="table") }} with - int_core__booking_summary as (select * from {{ ref("int_core__booking_summary") }}), + int_booking_summary as (select * from {{ ref("int_booking_summary") }}), int_resolutions__incidents as ( select * from {{ ref("int_resolutions__incidents") }} ), @@ -66,7 +66,7 @@ with then false else null end as is_booking_flagged_as_risk - from int_core__booking_summary + from int_booking_summary where -- Bookings from New Dash users with Id Deal is_user_in_new_dash = true diff --git a/models/intermediate/cross/int_new_dash_deal_onboarding.sql b/models/intermediate/cross/int_new_dash_deal_onboarding.sql index ec9cdf1..abf0ddf 100644 --- a/models/intermediate/cross/int_new_dash_deal_onboarding.sql +++ b/models/intermediate/cross/int_new_dash_deal_onboarding.sql @@ -3,7 +3,7 @@ with int_core__user_host as (select * from {{ ref("int_core__user_host") }}), int_hubspot__deal as (select * from {{ ref("int_hubspot__deal") }}), int_core__accommodation as (select * from {{ ref("int_core__accommodation") }}), - int_core__booking_summary as (select * from {{ ref("int_core__booking_summary") }}), + int_booking_summary as (select * from {{ ref("int_booking_summary") }}), int_core__user_product_bundle_contains_services as ( select * from {{ ref("int_core__user_product_bundle_contains_services") }} ), @@ -162,7 +162,7 @@ with count( distinct case when bs.has_paid_services then bs.id_booking else null end ) as count_bookings_with_paid_service - from int_core__booking_summary bs + from int_booking_summary bs where id_deal is not null group by 1 ), diff --git a/models/intermediate/cross/schema.yml b/models/intermediate/cross/schema.yml index c5ac505..9490a61 100644 --- a/models/intermediate/cross/schema.yml +++ b/models/intermediate/cross/schema.yml @@ -3403,3 +3403,384 @@ models: - dbt_expectations.expect_column_values_to_be_between: min_value: 0 strictly: false + + - name: int_booking_summary + description: | + This model contains enriched information aggregated at Booking level regarding + the services that are applied within a Booking. + Specifically, contains both Booking and Services attributes (aggregated), as well + as the total price in GBP at this specific moment in time. In other words, + it's the snapshot of the current status of the Booking. + It's a subset of all bookings since it only applies to bookings that come from + hosts that have been migrated into the New Dash or New Pricing. + + If you want to retrieve only New Dash Bookings, you will need to apply the following + filters: + - is_user_in_new_dash = True + - is_missing_id_deal = False + + data_tests: + - dbt_expectations.expect_column_pair_values_A_to_be_greater_than_B: + column_A: booking_check_out_at_utc + column_B: booking_check_in_at_utc + or_equal: True + - dbt_expectations.expect_column_pair_values_A_to_be_greater_than_B: + column_A: number_of_applied_services + column_B: number_of_applied_paid_services + or_equal: True + - dbt_expectations.expect_column_pair_values_A_to_be_greater_than_B: + column_A: number_of_applied_services + column_B: number_of_applied_upgraded_services + or_equal: True + + columns: + - name: id_booking + data_type: bigint + description: | + The identifier of the booking. Acts as Primary Key to this table. + Cannot be null. + data_tests: + - not_null + - unique + + - 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: id_accommodation + data_type: bigint + description: + The identifier of the accommodation or listing. It acts as Foreign Key + to the Accommodation table. It cannot be null. + data_tests: + - not_null + + - name: id_user_product_bundle + data_type: bigint + description: + The identifier of the Product Bundle, or program, that a User has applied + to the Booking. It acts as Foreign Key to the User Product Bundle table. + It cannot be null. + data_tests: + - not_null + + - name: id_deal + data_type: string + description: | + Unique identifier of the account. It can be null. + + - name: id_user_host + data_type: string + description: | + Unique identifier of the user that acts as a Host. Cannot be null. + data_tests: + - not_null + + - name: id_user_guest + data_type: string + description: | + Unique identifier of the user that acts as a Guest. + Can be null if Superhog does not interact with the Guest. + + - name: booking_status + data_type: string + description: | + The current status of the booking. Cannot be null. + data_tests: + - not_null + + - name: program_name + data_type: string + description: | + The name of the program, or product bundle, applied to the booking. + Cannot be null. + data_tests: + - not_null + + - name: booking_created_at_utc + data_type: timestamp + description: | + Timestamp of when the Booking record was created in the Backend. + Cannot be null. + data_tests: + - not_null + + - name: booking_created_date_utc + data_type: date + description: | + Date of when the Booking record was created in the Backend. + Cannot be null. + data_tests: + - not_null + + - name: booking_updated_at_utc + data_type: timestamp + description: | + Timestamp of when the Booking record was last updated in the Backend. + Cannot be null. + data_tests: + - not_null + + - name: booking_updated_date_utc + data_type: date + description: | + Date of when the Booking record was last updated in the Backend. + Cannot be null. + data_tests: + - not_null + + - name: booking_check_in_at_utc + data_type: timestamp + description: | + Timestamp of the Check-in of the Booking. + Cannot be null. + data_tests: + - not_null + + - name: booking_check_in_date_utc + data_type: timestamp + description: | + Date of the Check-in of the Booking. + Cannot be null. + data_tests: + - not_null + + - name: booking_check_out_at_utc + data_type: timestamp + description: | + Timestamp of the Check-out of the Booking. + Cannot be null. + data_tests: + - not_null + + - name: booking_check_out_date_utc + data_type: date + description: | + Date of the Check-out of the Booking. + data_tests: + - not_null + + - name: booking_number_of_nights + data_type: integer + description: | + Number of nights between Check-in date and Check-out date. + + - name: host_currency_code + data_type: string + description: | + Iso 4217 currency code for the account of the Host. + It can be null. + + - name: is_user_in_new_dash + data_type: boolean + description: | + Flag to determine if this user host is in New Dash or not. + data_tests: + - not_null + + - name: new_dash_version + data_type: string + description: | + For users that are in New Dash, specifies the New Dash Version + in which these users were moved or joined. It can be null if + the user is not in new dash. + + - name: user_in_new_dash_since_timestamp_at_utc + data_type: timestamp + description: | + For users that are in New Dash, the effective date since + these users can be considered in New Dash. If the user + has moved from Old Dash, it will be the new_dash_move_at_utc. + If not, it will correspond to the joined_at_utc. It can be null + if the user is not in new dash. + + - name: booking_total_price_in_gbp + data_type: decimal + description: | + Identifies the current total price of the booking by adding up the + prices of each service applied to this booking, converted in GBP. + Can be null. Can vary over time depending on the service status, + payments, etc, as well as it can vary over time until the chargeable + date due to the currency rate estimation in the future. + + - name: service_first_chargeable_date_utc + data_type: date + description: | + Identifies the first moment in time in which the first + service applied to this booking is supposed to be charged. + + - name: service_last_chargeable_date_utc + data_type: date + description: | + Identifies the last moment in time in which the last + service applied to this booking is supposed to be charged. + + - name: service_first_billable_date_utc + data_type: date + description: | + Identifies the first moment in time in which the first + service applied to this booking is supposed to be billed. + This excludes Guest Payments, and only includes services to + be invoiced to the Host. + + - name: service_last_billable_date_utc + data_type: date + description: | + Identifies the last moment in time in which the last + service applied to this booking is supposed to be billed. + This excludes Guest Payments, and only includes services to + be invoiced to the Host. + + - name: service_first_created_at_utc + data_type: timestamp + description: | + Timestamp corresponding to the first creation of a Service + record applied to this Booking, according to the Backend. + data_tests: + - not_null + + - name: service_last_created_at_utc + data_type: timestamp + description: | + Timestamp corresponding to the latest creation of a Service + record applied to this Booking, according to the Backend. + data_tests: + - not_null + + - name: service_last_updated_at_utc + data_type: timestamp + description: | + Timestamp corresponding to the latest update on any Service + record applied to this Booking, according to the Backend. + data_tests: + - not_null + + - name: number_of_applied_services + data_type: integer + description: | + Total number of Services applied to this Booking. + + - name: number_of_applied_paid_services + data_type: integer + description: | + Total number of Services that require a monetary + income to Superhog applied to this Booking. + + - name: number_of_applied_upgraded_services + data_type: integer + description: | + Total number of Services different from Basic Screening + applied to this Booking. + + - name: number_of_applied_billable_services + data_type: integer + description: | + Total number of Services that require an invoice to the Host + to the Host, that are applied to this Booking. + + - name: is_booking_chargeable + data_type: boolean + description: | + Flag to identify it the Booking is chargeable or not. + In essence, it solves the question: are we supposed to get + money out of this booking, or not? + To be considered as chargeable, a chargeable date needs to exist + as well as the total price converted to GBP needs to be strictly + greater than 0. The fact that a booking is not chargeable does + not necessarily mean that it won't be in the future. Similarly, if + the booking is chargeable it does not necessarily mean that is actually + charged. It cannot be null. + data_tests: + - not_null + + - name: is_booking_billable + data_type: boolean + description: | + Flag to identify it the Booking is billable or not. + In essence, it solves the question: are we supposed to invoice + a certain amount to the host to get money out of this booking, or not? + To be considered as billable, a billable date needs to exist + as well as the total price of billable services, converted to GBP, + need to be strictly greater than 0. + The fact that a booking is not billable does not necessarily mean that + it won't be in the future. + The fact that a booking is not billable does not necessarily mean that + it's not chargeable, since Guest Payments could still apply. + Similarly, if the booking is billable it does not necessarily mean that + is actually billed. + It cannot be null. + data_tests: + - not_null + + - name: is_missing_currency_code_in_service_detail + data_type: boolean + description: | + Flag to identify if the currency code is missing in any + Booking Service Detail record for this Booking. + + - name: is_booking_cancelled + data_type: boolean + description: | + Flag to identify if the booking has been cancelled or not. + + - name: has_verification_request + data_type: boolean + description: | + Flag to identify if the booking has a verification request or not. + Cannot be null. + data_tests: + - not_null + + - name: has_paid_services + data_type: boolean + description: | + Flag to identify if the booking has any paid service or not. + + - name: has_upgraded_services + data_type: boolean + description: | + Flag to identify if the booking has any service different from + Basic Screening or not. + + - name: has_billable_services + data_type: boolean + description: | + Flag to identify if the booking has any billable service or not. + + - name: has_screening_service_business_type + data_type: boolean + description: | + Flag to identify if the booking contains any Screening service + or not. + + - name: has_upgraded_screening_service_business_type + data_type: boolean + description: | + Flag to identify if the booking contains any Screening services + different from Basic Screening. + + - name: has_deposit_management_service_business_type + data_type: boolean + description: | + Flag to identify if the booking contains any Deposit + Management service or not. + + - name: has_protection_service_business_type + data_type: boolean + description: | + Flag to identify if the booking contains any Protection + service or not. + + - name: is_missing_id_deal + data_type: boolean + description: | + Flag to identify if the Host for this booking is missing + the Id Deal or not. + + - name: is_missing_host_currency_code + data_type: boolean + description: | + Flag to identify if the Host for this booking is missing + the currency code or not. diff --git a/models/intermediate/kpis/int_kpis__metric_daily_billable_bookings.sql b/models/intermediate/kpis/int_kpis__metric_daily_billable_bookings.sql index caaf37a..6c08b9c 100644 --- a/models/intermediate/kpis/int_kpis__metric_daily_billable_bookings.sql +++ b/models/intermediate/kpis/int_kpis__metric_daily_billable_bookings.sql @@ -23,7 +23,7 @@ left join on icuh.id_deal = icmas.id_deal and icb.booking_fee_charge_date_utc = icmas.date left join - {{ ref("int_core__booking_summary") }} as icbs on icb.id_booking = icbs.id_booking + {{ ref("int_booking_summary") }} as icbs on icb.id_booking = icbs.id_booking where icb.is_duplicate_booking = false and icb.booking_fee_charge_date_utc is not null @@ -48,7 +48,7 @@ select ) as active_accommodations_per_deal_segmentation, -- Metrics -- count(distinct icbs.id_booking) as billable_bookings -from {{ ref("int_core__booking_summary") }} icbs +from {{ ref("int_booking_summary") }} icbs left join {{ ref("int_core__deal") }} as icd on icbs.id_deal = icd.id_deal left join {{ ref("int_kpis__dimension_daily_accommodation") }} as icmas diff --git a/models/intermediate/kpis/int_kpis__metric_daily_check_out_bookings.sql b/models/intermediate/kpis/int_kpis__metric_daily_check_out_bookings.sql index 02c8eb6..721dbcf 100644 --- a/models/intermediate/kpis/int_kpis__metric_daily_check_out_bookings.sql +++ b/models/intermediate/kpis/int_kpis__metric_daily_check_out_bookings.sql @@ -67,6 +67,6 @@ left join on icuh.id_deal = icmas.id_deal and icb.check_out_date_utc = icmas.date left join - {{ ref("int_core__booking_summary") }} as icbs on icb.id_booking = icbs.id_booking + {{ ref("int_booking_summary") }} as icbs on icb.id_booking = icbs.id_booking where icb.is_duplicate_booking = false group by 1, 2, 3, 4, 5 diff --git a/models/intermediate/kpis/int_kpis__metric_daily_completed_guest_journeys.sql b/models/intermediate/kpis/int_kpis__metric_daily_completed_guest_journeys.sql index 57e280b..5ca4c43 100644 --- a/models/intermediate/kpis/int_kpis__metric_daily_completed_guest_journeys.sql +++ b/models/intermediate/kpis/int_kpis__metric_daily_completed_guest_journeys.sql @@ -34,7 +34,7 @@ left join on icuh.id_deal = icmas.id_deal and icvr.verification_estimated_completed_date_utc = icmas.date left join - {{ ref("int_core__booking_summary") }} as icbs + {{ ref("int_booking_summary") }} as icbs on icvr.id_verification_request = icbs.id_verification_request where icvr.verification_estimated_completed_date_utc is not null group by 1, 2, 3, 4, 5 diff --git a/models/intermediate/kpis/int_kpis__metric_daily_created_bookings.sql b/models/intermediate/kpis/int_kpis__metric_daily_created_bookings.sql index f04d31d..7e163fb 100644 --- a/models/intermediate/kpis/int_kpis__metric_daily_created_bookings.sql +++ b/models/intermediate/kpis/int_kpis__metric_daily_created_bookings.sql @@ -48,6 +48,6 @@ left join on icuh.id_deal = icmas.id_deal and icb.created_date_utc = icmas.date left join - {{ ref("int_core__booking_summary") }} as icbs on icb.id_booking = icbs.id_booking + {{ ref("int_booking_summary") }} as icbs on icb.id_booking = icbs.id_booking where icb.is_duplicate_booking = false group by 1, 2, 3, 4, 5 diff --git a/models/intermediate/kpis/int_kpis__metric_daily_created_guest_journeys.sql b/models/intermediate/kpis/int_kpis__metric_daily_created_guest_journeys.sql index 4cfd235..1645ae1 100644 --- a/models/intermediate/kpis/int_kpis__metric_daily_created_guest_journeys.sql +++ b/models/intermediate/kpis/int_kpis__metric_daily_created_guest_journeys.sql @@ -34,6 +34,6 @@ left join on icuh.id_deal = icmas.id_deal and icvr.created_date_utc = icmas.date left join - {{ ref("int_core__booking_summary") }} as icbs + {{ ref("int_booking_summary") }} as icbs on icvr.id_verification_request = icbs.id_verification_request group by 1, 2, 3, 4, 5 diff --git a/models/intermediate/kpis/int_kpis__metric_daily_guest_journeys_with_payment.sql b/models/intermediate/kpis/int_kpis__metric_daily_guest_journeys_with_payment.sql index 14347e1..a7a7125 100644 --- a/models/intermediate/kpis/int_kpis__metric_daily_guest_journeys_with_payment.sql +++ b/models/intermediate/kpis/int_kpis__metric_daily_guest_journeys_with_payment.sql @@ -43,6 +43,6 @@ left join on icuh.id_deal = icmas.id_deal and p.first_payment_paid_date_utc = icmas.date left join - {{ ref("int_core__booking_summary") }} as icbs + {{ ref("int_booking_summary") }} as icbs on p.id_verification_request = icbs.id_verification_request group by 1, 2, 3, 4, 5 diff --git a/models/intermediate/kpis/int_kpis__metric_daily_guest_payments.sql b/models/intermediate/kpis/int_kpis__metric_daily_guest_payments.sql index 39b27d4..bb77398 100644 --- a/models/intermediate/kpis/int_kpis__metric_daily_guest_payments.sql +++ b/models/intermediate/kpis/int_kpis__metric_daily_guest_payments.sql @@ -91,7 +91,7 @@ left join on icuh.id_deal = icmas.id_deal and icgjp.payment_paid_date_utc = icmas.date left join - {{ ref("int_core__booking_summary") }} as icbs + {{ ref("int_booking_summary") }} as icbs on icgjp.id_verification_request = icbs.id_verification_request where icgjp.is_paid_status = true group by 1, 2, 3, 4, 5, 6 diff --git a/models/intermediate/kpis/int_kpis__metric_daily_new_dash_chargeable_services.sql b/models/intermediate/kpis/int_kpis__metric_daily_new_dash_chargeable_services.sql index 246c1ab..c36d607 100644 --- a/models/intermediate/kpis/int_kpis__metric_daily_new_dash_chargeable_services.sql +++ b/models/intermediate/kpis/int_kpis__metric_daily_new_dash_chargeable_services.sql @@ -24,7 +24,7 @@ select -- Metrics -- count(distinct icbsd.id_booking_service_detail) as chargeable_services, sum(icbsd.service_total_price_in_gbp) as service_total_price_in_gbp -from {{ ref("int_core__booking_summary") }} as icbs +from {{ ref("int_booking_summary") }} as icbs inner join {{ ref("int_core__booking_service_detail") }} as icbsd on icbs.id_booking = icbsd.id_booking diff --git a/models/intermediate/kpis/int_kpis__metric_daily_new_dash_created_bookings.sql b/models/intermediate/kpis/int_kpis__metric_daily_new_dash_created_bookings.sql index 9d332d7..55d9f81 100644 --- a/models/intermediate/kpis/int_kpis__metric_daily_new_dash_created_bookings.sql +++ b/models/intermediate/kpis/int_kpis__metric_daily_new_dash_created_bookings.sql @@ -27,7 +27,7 @@ select coalesce( icmas.active_accommodations_per_deal_segmentation, 'UNSET' ) as active_accommodations_per_deal_segmentation -from {{ ref("int_core__booking_summary") }} as bs +from {{ ref("int_booking_summary") }} as bs inner join {{ ref("int_core__booking_service_detail") }} as icbsd on bs.id_booking = icbsd.id_booking diff --git a/models/intermediate/kpis/int_kpis__metric_daily_new_dash_created_services.sql b/models/intermediate/kpis/int_kpis__metric_daily_new_dash_created_services.sql index 56fe11a..3d4ee04 100644 --- a/models/intermediate/kpis/int_kpis__metric_daily_new_dash_created_services.sql +++ b/models/intermediate/kpis/int_kpis__metric_daily_new_dash_created_services.sql @@ -22,7 +22,7 @@ select ) as active_accommodations_per_deal_segmentation, -- Metrics -- count(distinct icbsd.id_booking_service_detail) as created_services -from {{ ref("int_core__booking_summary") }} as icbs +from {{ ref("int_booking_summary") }} as icbs inner join {{ ref("int_core__booking_service_detail") }} as icbsd on icbs.id_booking = icbsd.id_booking diff --git a/models/intermediate/kpis/int_kpis__metric_daily_started_guest_journeys.sql b/models/intermediate/kpis/int_kpis__metric_daily_started_guest_journeys.sql index 1db8e36..acb13f3 100644 --- a/models/intermediate/kpis/int_kpis__metric_daily_started_guest_journeys.sql +++ b/models/intermediate/kpis/int_kpis__metric_daily_started_guest_journeys.sql @@ -34,7 +34,7 @@ left join on icuh.id_deal = icmas.id_deal and icvr.verification_estimated_started_date_utc = icmas.date left join - {{ ref("int_core__booking_summary") }} as icbs + {{ ref("int_booking_summary") }} as icbs on icvr.id_verification_request = icbs.id_verification_request where icvr.verification_estimated_started_date_utc is not null group by 1, 2, 3, 4, 5 diff --git a/models/reporting/general/new_dash_booking_summary.sql b/models/reporting/general/new_dash_booking_summary.sql index 88964f0..934db83 100644 --- a/models/reporting/general/new_dash_booking_summary.sql +++ b/models/reporting/general/new_dash_booking_summary.sql @@ -1,5 +1,5 @@ with - int_core__booking_summary as (select * from {{ ref("int_core__booking_summary") }}), + int_booking_summary as (select * from {{ ref("int_booking_summary") }}), int_core__deal as (select * from {{ ref("int_core__deal") }}), int_hubspot__deal as (select * from {{ ref("int_hubspot__deal") }}) @@ -37,7 +37,7 @@ select b.has_deposit_management_service_business_type as has_deposit_management_service_business_type, b.has_protection_service_business_type as has_protection_service_business_type -from int_core__booking_summary b +from int_booking_summary b left join int_core__deal d on b.id_deal = d.id_deal left join int_hubspot__deal hd on b.id_deal = hd.id_deal -- Select only New Dash bookings