Merged PR 5281: First version of stg_core__user_product_bundle_to_guest_product

# Description

First version in staging of stg_core__user_product_bundle_to_guest_product.

This table informs which Guest Products are enabled for a given New Dash bundle (or program).

Be aware that for these to be effective, the bundle needs to be applied and active to an active listing that generates bookings.

# 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: #30165
This commit is contained in:
Oriol Roqué Paniagua 2025-05-22 08:15:26 +00:00
parent 7e5d94e1b8
commit e6819f05cc
3 changed files with 112 additions and 0 deletions

View file

@ -281,6 +281,8 @@ sources:
identifier: VerificationRequestToGuestProduct
- name: VerificationRequestGuestProductToPayment
identifier: VerificationRequestGuestProductToPayment
- name: UserProductBundleToGuestProduct
identifier: UserProductBundleToGuestProduct
- name: guest_product
schema: sync_guest_product

View file

@ -2386,3 +2386,85 @@ models:
data_type: timestamp with time zone
description: |
Timestamp of when this record was extracted into DWH.
- name: stg_core__user_product_bundle_to_guest_product
description: |
Contains the relationship between a User Product Bundle and a Guest Product.
This table is used to track the guest products that are part of a user product bundle,
and whether these are enabled or not.
Note that user product bundles that do not contain an equivalent record in this table
indicate that the guest product is not enabled for that user product bundle.
Note that this table effectively only contains the last status in terms of enabled/disabled
guest products for a user product bundle.
columns:
- name: id_user_product_bundle_to_guest_product
data_type: bigint
description: |
Unique identifier of the user product bundle to guest product.
Acts as the primary key for this table.
data_tests:
- not_null
- unique
- name: id_user_product_bundle
data_type: bigint
description: |
Identifier of the user product bundle.
data_tests:
- not_null
- name: id_guest_product
data_type: bigint
description: |
Identifier of the guest product.
data_tests:
- not_null
- name: is_enabled
data_type: boolean
description: |
Indicates if the guest product is enabled or not.
- If true, then the guest product is enabled.
- If false, then the guest product is disabled.
data_tests:
- not_null
- name: created_at_utc
data_type: timestamp
description: |
Timestamp of when this record was created.
data_tests:
- not_null
- name: created_date_utc
data_type: date
description: |
Date of when this record was created.
data_tests:
- not_null
- name: updated_at_utc
data_type: timestamp
description: |
Timestamp of when this record was last updated.
Defaults to created_at_utc if the original record contains a
null UpdatedDate.
data_tests:
- not_null
- name: updated_date_utc
data_type: date
description: |
Date of when this record was last updated.
Defaults to created_date_utc if the original record contains a
null UpdatedDate.
data_tests:
- not_null
- name: dwh_extracted_at_utc
data_type: timestamp with time zone
description: |
Timestamp of when this record was extracted into DWH.
data_tests:
- not_null

View file

@ -0,0 +1,28 @@
with
raw_user_product_bundle_to_guest_product as (
select * from {{ source("core", "UserProductBundleToGuestProduct") }}
),
stg_core__user_product_bundle_to_guest_product as (
select
{{ adapter.quote("Id") }} as id_user_product_bundle_to_guest_product,
{{ adapter.quote("GuestProductId") }} as id_guest_product,
{{ adapter.quote("UserProductBundleId") }} as id_user_product_bundle,
{{ adapter.quote("IsEnabled") }} as is_enabled,
{{ adapter.quote("CreatedDate") }} as created_at_utc,
date({{ adapter.quote("CreatedDate") }}) as created_date_utc,
-- UpdatedDate is nullable. In these cases, we default to CreatedDate
coalesce(
{{ adapter.quote("UpdatedDate") }},{{ adapter.quote("CreatedDate") }}
) as updated_at_utc,
date(
coalesce(
{{ adapter.quote("UpdatedDate") }},
{{ adapter.quote("CreatedDate") }}
)
) as updated_date_utc,
{{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_utc
from raw_user_product_bundle_to_guest_product
)
select *
from stg_core__user_product_bundle_to_guest_product