Merged PR 2650: Added int_core__booking_to_product_bundle in intermediate

# Description

Creates a new view with the bookings that come from New Dash, linked to the Product Bundles. Extensive documentation added, please check it out and if something is not clear I'll modify it.

# 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.
- [ ] I've picked the right materialization for the affected models. To be discussed. There's not huge data still so view looks ok to me. I guess, maybe, in the future, we will have a flag or similar in int_core__bookings to detect if a bookings comes from New Dash/New Pricing or not, but it's still early to decide. In any case this model is needed for immediate New Dash MVP reporting so I propose to keep it like this as a view and afterwards we can decide if it makes more sense to materialise it differently.

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Related work items: #19570
This commit is contained in:
Oriol Roqué Paniagua 2024-08-27 12:51:55 +00:00
parent c613d2859f
commit b927635cf1
2 changed files with 116 additions and 1 deletions

View file

@ -0,0 +1,28 @@
with
stg_core__booking_to_product_bundle as (
select * from {{ ref("stg_core__booking_to_product_bundle") }}
),
int_core__user_product_bundle as (
select * from {{ ref("int_core__user_product_bundle") }}
)
select
btpb.id_booking_to_product_bundle,
btpb.id_booking,
btpb.id_user_product_bundle,
upb.id_user_host,
upb.product_bundle_name as user_product_bundle_name,
btpb.created_at_utc,
btpb.created_date_utc,
btpb.updated_at_utc,
btpb.updated_date_utc,
btpb.dwh_extracted_at
from stg_core__booking_to_product_bundle as btpb
inner join
int_core__user_product_bundle as upb
on btpb.id_user_product_bundle = upb.id_user_product_bundle
and btpb.created_date_utc >= upb.effective_start_date_utc
and (
btpb.created_date_utc <= upb.effective_end_date_utc
or upb.effective_end_date_utc is null
)

View file

@ -2307,7 +2307,7 @@ models:
- name: id_user_product_bundle
data_type: bigint
description: |
The identifier unique identifier of this table.
The unique identifier of this table.
tests:
- not_null
- unique
@ -2420,3 +2420,90 @@ models:
data_type: timestamp
description: |
Timestamp of when this row was ingested from the Backend to the DWH.
- name: int_core__booking_to_product_bundle
description: |
This model contains the information of which booking is linked to a
specific product bundle. 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.
Note: at this moment, it's not straight-forward to know which product service
is applied in the booking. We only know that a booking is linked to a product
bundle, but not the service that applies from those available within the
product bundle. Likely this is not an issue for the MVP since there's only 2
bundles and 2 services, and the only bundle that has a paid service is Basic
Program.
Note: to improve data quality, there's an inner join with
int_core__user_product_bundle to ensure that bookings need to 1) come from
hosts that appear in the table and 2) be created after the user's effective
start of the product bundle. This is because there's some previous booking
data that it's before the New Dash MVP start date.
columns:
- name: id_booking_to_product_bundle
data_type: bigint
description: |
The unique identifier of this table.
tests:
- not_null
- unique
- name: id_booking
data_type: bigint
description: |
The identifier of the booking that has a product bundle.
A booking appearing here would mean it's under the New Dash &
the New Pricing structure. It is expected that bookings are
unique within this model.
tests:
- not_null
- unique
- name: id_user_product_bundle
data_type: bigint
description: |
The identifier of the user product bundle. This allows the retrieval
of the information of the product bundle associated at the user level.
tests:
- not_null
- name: id_user_host
data_type: string
description: |
The identifier of the user that acts as a host. Only Hosts that have
New Pricing in the New Dash structure that have had bookings will
appear in this model.
tests:
- not_null
- name: product_bundle_name
data_type: string
description: |
The CamelCase name of the Product Bundle.
- name: created_at_utc
data_type: timestamp
description: |
Timestamp of when this Booking to Product Bundle row was created in the Backend.
- name: created_date_utc
data_type: date
description: |
Date of when this Booking to Product Bundle row was created in the Backend.
- name: updated_at_utc
data_type: timestamp
description: |
Timestamp of when this Booking to Product Bundle row was last updated in the Backend.
- name: updated_date_utc
data_type: date
description: |
Date of when this Booking to Product Bundle row was last updated in the Backend.
- name: dwh_extracted_at
data_type: timestamp with timezone
description: |
Timestamp of when this row was ingested from the Backend to the DWH.