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
This commit is contained in:
Oriol Roqué Paniagua 2025-05-30 12:51:10 +00:00
parent a9a1e68624
commit d33e5ff2b2
17 changed files with 399 additions and 393 deletions

View file

@ -3801,381 +3801,6 @@ models:
fields will contain different dates. It can be null, thus meaning fields will contain different dates. It can be null, thus meaning
there's no chargeable date at all. 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 - name: int_core__product_service_billing_item
description: | description: |
Provides the Billing Items for Product Services in the scope of Provides the Billing Items for Product Services in the scope of

View file

@ -18,7 +18,7 @@
{{ config(materialized="table") }} {{ config(materialized="table") }}
with 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 ( int_resolutions__incidents as (
select * from {{ ref("int_resolutions__incidents") }} select * from {{ ref("int_resolutions__incidents") }}
), ),
@ -66,7 +66,7 @@ with
then false then false
else null else null
end as is_booking_flagged_as_risk end as is_booking_flagged_as_risk
from int_core__booking_summary from int_booking_summary
where where
-- Bookings from New Dash users with Id Deal -- Bookings from New Dash users with Id Deal
is_user_in_new_dash = true is_user_in_new_dash = true

View file

@ -3,7 +3,7 @@ with
int_core__user_host as (select * from {{ ref("int_core__user_host") }}), int_core__user_host as (select * from {{ ref("int_core__user_host") }}),
int_hubspot__deal as (select * from {{ ref("int_hubspot__deal") }}), int_hubspot__deal as (select * from {{ ref("int_hubspot__deal") }}),
int_core__accommodation as (select * from {{ ref("int_core__accommodation") }}), 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 ( int_core__user_product_bundle_contains_services as (
select * from {{ ref("int_core__user_product_bundle_contains_services") }} select * from {{ ref("int_core__user_product_bundle_contains_services") }}
), ),
@ -162,7 +162,7 @@ with
count( count(
distinct case when bs.has_paid_services then bs.id_booking else null end distinct case when bs.has_paid_services then bs.id_booking else null end
) as count_bookings_with_paid_service ) as count_bookings_with_paid_service
from int_core__booking_summary bs from int_booking_summary bs
where id_deal is not null where id_deal is not null
group by 1 group by 1
), ),

View file

@ -3403,3 +3403,384 @@ models:
- dbt_expectations.expect_column_values_to_be_between: - dbt_expectations.expect_column_values_to_be_between:
min_value: 0 min_value: 0
strictly: false 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.

View file

@ -23,7 +23,7 @@ left join
on icuh.id_deal = icmas.id_deal on icuh.id_deal = icmas.id_deal
and icb.booking_fee_charge_date_utc = icmas.date and icb.booking_fee_charge_date_utc = icmas.date
left join 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 where
icb.is_duplicate_booking = false icb.is_duplicate_booking = false
and icb.booking_fee_charge_date_utc is not null and icb.booking_fee_charge_date_utc is not null
@ -48,7 +48,7 @@ select
) as active_accommodations_per_deal_segmentation, ) as active_accommodations_per_deal_segmentation,
-- Metrics -- -- Metrics --
count(distinct icbs.id_booking) as billable_bookings 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_core__deal") }} as icd on icbs.id_deal = icd.id_deal
left join left join
{{ ref("int_kpis__dimension_daily_accommodation") }} as icmas {{ ref("int_kpis__dimension_daily_accommodation") }} as icmas

View file

@ -67,6 +67,6 @@ left join
on icuh.id_deal = icmas.id_deal on icuh.id_deal = icmas.id_deal
and icb.check_out_date_utc = icmas.date and icb.check_out_date_utc = icmas.date
left join 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 where icb.is_duplicate_booking = false
group by 1, 2, 3, 4, 5 group by 1, 2, 3, 4, 5

View file

@ -34,7 +34,7 @@ left join
on icuh.id_deal = icmas.id_deal on icuh.id_deal = icmas.id_deal
and icvr.verification_estimated_completed_date_utc = icmas.date and icvr.verification_estimated_completed_date_utc = icmas.date
left join left join
{{ ref("int_core__booking_summary") }} as icbs {{ ref("int_booking_summary") }} as icbs
on icvr.id_verification_request = icbs.id_verification_request on icvr.id_verification_request = icbs.id_verification_request
where icvr.verification_estimated_completed_date_utc is not null where icvr.verification_estimated_completed_date_utc is not null
group by 1, 2, 3, 4, 5 group by 1, 2, 3, 4, 5

View file

@ -48,6 +48,6 @@ left join
on icuh.id_deal = icmas.id_deal on icuh.id_deal = icmas.id_deal
and icb.created_date_utc = icmas.date and icb.created_date_utc = icmas.date
left join 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 where icb.is_duplicate_booking = false
group by 1, 2, 3, 4, 5 group by 1, 2, 3, 4, 5

View file

@ -34,6 +34,6 @@ left join
on icuh.id_deal = icmas.id_deal on icuh.id_deal = icmas.id_deal
and icvr.created_date_utc = icmas.date and icvr.created_date_utc = icmas.date
left join left join
{{ ref("int_core__booking_summary") }} as icbs {{ ref("int_booking_summary") }} as icbs
on icvr.id_verification_request = icbs.id_verification_request on icvr.id_verification_request = icbs.id_verification_request
group by 1, 2, 3, 4, 5 group by 1, 2, 3, 4, 5

View file

@ -43,6 +43,6 @@ left join
on icuh.id_deal = icmas.id_deal on icuh.id_deal = icmas.id_deal
and p.first_payment_paid_date_utc = icmas.date and p.first_payment_paid_date_utc = icmas.date
left join left join
{{ ref("int_core__booking_summary") }} as icbs {{ ref("int_booking_summary") }} as icbs
on p.id_verification_request = icbs.id_verification_request on p.id_verification_request = icbs.id_verification_request
group by 1, 2, 3, 4, 5 group by 1, 2, 3, 4, 5

View file

@ -91,7 +91,7 @@ left join
on icuh.id_deal = icmas.id_deal on icuh.id_deal = icmas.id_deal
and icgjp.payment_paid_date_utc = icmas.date and icgjp.payment_paid_date_utc = icmas.date
left join left join
{{ ref("int_core__booking_summary") }} as icbs {{ ref("int_booking_summary") }} as icbs
on icgjp.id_verification_request = icbs.id_verification_request on icgjp.id_verification_request = icbs.id_verification_request
where icgjp.is_paid_status = true where icgjp.is_paid_status = true
group by 1, 2, 3, 4, 5, 6 group by 1, 2, 3, 4, 5, 6

View file

@ -24,7 +24,7 @@ select
-- Metrics -- -- Metrics --
count(distinct icbsd.id_booking_service_detail) as chargeable_services, count(distinct icbsd.id_booking_service_detail) as chargeable_services,
sum(icbsd.service_total_price_in_gbp) as service_total_price_in_gbp 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 inner join
{{ ref("int_core__booking_service_detail") }} as icbsd {{ ref("int_core__booking_service_detail") }} as icbsd
on icbs.id_booking = icbsd.id_booking on icbs.id_booking = icbsd.id_booking

View file

@ -27,7 +27,7 @@ select
coalesce( coalesce(
icmas.active_accommodations_per_deal_segmentation, 'UNSET' icmas.active_accommodations_per_deal_segmentation, 'UNSET'
) as active_accommodations_per_deal_segmentation ) as active_accommodations_per_deal_segmentation
from {{ ref("int_core__booking_summary") }} as bs from {{ ref("int_booking_summary") }} as bs
inner join inner join
{{ ref("int_core__booking_service_detail") }} as icbsd {{ ref("int_core__booking_service_detail") }} as icbsd
on bs.id_booking = icbsd.id_booking on bs.id_booking = icbsd.id_booking

View file

@ -22,7 +22,7 @@ select
) as active_accommodations_per_deal_segmentation, ) as active_accommodations_per_deal_segmentation,
-- Metrics -- -- Metrics --
count(distinct icbsd.id_booking_service_detail) as created_services 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 inner join
{{ ref("int_core__booking_service_detail") }} as icbsd {{ ref("int_core__booking_service_detail") }} as icbsd
on icbs.id_booking = icbsd.id_booking on icbs.id_booking = icbsd.id_booking

View file

@ -34,7 +34,7 @@ left join
on icuh.id_deal = icmas.id_deal on icuh.id_deal = icmas.id_deal
and icvr.verification_estimated_started_date_utc = icmas.date and icvr.verification_estimated_started_date_utc = icmas.date
left join left join
{{ ref("int_core__booking_summary") }} as icbs {{ ref("int_booking_summary") }} as icbs
on icvr.id_verification_request = icbs.id_verification_request on icvr.id_verification_request = icbs.id_verification_request
where icvr.verification_estimated_started_date_utc is not null where icvr.verification_estimated_started_date_utc is not null
group by 1, 2, 3, 4, 5 group by 1, 2, 3, 4, 5

View file

@ -1,5 +1,5 @@
with 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_core__deal as (select * from {{ ref("int_core__deal") }}),
int_hubspot__deal as (select * from {{ ref("int_hubspot__deal") }}) int_hubspot__deal as (select * from {{ ref("int_hubspot__deal") }})
@ -37,7 +37,7 @@ select
b.has_deposit_management_service_business_type b.has_deposit_management_service_business_type
as 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 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_core__deal d on b.id_deal = d.id_deal
left join int_hubspot__deal hd on b.id_deal = hd.id_deal left join int_hubspot__deal hd on b.id_deal = hd.id_deal
-- Select only New Dash bookings -- Select only New Dash bookings