Merged PR 2647: Adding accommodation_to_product_bundle to stg

# Description

Adds accommodation to product bundle table from sync_core to staging. Note that this table still has no data because so far no listing has an associated product bundle.

Small change: removed in schema pending confirmation comments from Lou now that we've got an answer confirming it.

# Checklist

- [ ] The edited models and dependants run properly with production data: **N/A - there's no data :(**
- [X] The edited models are sufficiently documented.
- [ ] The edited models contain PK tests, and I've ran and passed them. **N/A - there's no data :(**
- [X] I have checked for DRY opportunities with other models and docs.
- [ ] I've picked the right materialization for the affected models. **N/A - there's no data :(**

# 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 08:57:23 +00:00
parent 46ff9514a6
commit cb3d1e628b
4 changed files with 34 additions and 3 deletions

View file

@ -2292,7 +2292,7 @@ models:
Important: Important:
A User having an active Product Bundle does NOT mean that the bundle is in use. A User having an active Product Bundle does NOT mean that the bundle is in use.
In order to be in use, the Product Bundle needs to be applied to a Listing. In order to be in use, the Product Bundle needs to be applied to a Listing.
Thus, the relationship in this table only shows, from user point of view, what Thus, the relationship in this table only shows, from user point of view, what
Product Bundles she/he can apply into a Listing. Product Bundles she/he can apply into a Listing.
@ -2331,7 +2331,7 @@ models:
data_type: int data_type: int
description: | description: |
The identifier of the Protection Plan. There's a 1 to 1 relationship between The identifier of the Protection Plan. There's a 1 to 1 relationship between
a Product Bundle and a Protection Plan. Pending confirmation of Lou D. a Product Bundle and a Protection Plan.
- name: product_bundle_name - name: product_bundle_name
data_type: string data_type: string
@ -2347,7 +2347,6 @@ models:
data_type: boolean data_type: boolean
description: | description: |
Flag that accounts for the capacity of a Host being able to modify the Product Bundle. Flag that accounts for the capacity of a Host being able to modify the Product Bundle.
Pending confirmation of Lou D.
- name: chosen_product_services - name: chosen_product_services
data_type: int data_type: int

View file

@ -229,3 +229,5 @@ sources:
identifier: AddressValidation identifier: AddressValidation
- name: VerificationToAddressValidation - name: VerificationToAddressValidation
identifier: VerificationToAddressValidation identifier: VerificationToAddressValidation
- name: AccommodationToProductBundle
identifier: AccommodationToProductBundle

View file

@ -185,6 +185,12 @@ models:
- unique - unique
- not_null - not_null
- name: id_address_validation - name: id_address_validation
tests:
- unique
- not_null
- name: stg_core__accommodation_to_product_bundle
columns:
- name: id_accommodation_to_product_bundle
tests: tests:
- unique - unique
- not_null - not_null

View file

@ -0,0 +1,24 @@
with
raw_accommodation_to_product_bundle as (
select * from {{ source("core", "AccommodationToProductBundle") }}
),
stg_core__accommodation_to_product_bundle as (
select
{{ adapter.quote("Id") }} as id_accommodation_to_product_bundle,
{{ adapter.quote("AccommodationId") }} as id_accommodation,
{{ adapter.quote("UserProductBundleId") }} as id_user_product_bundle,
{{ adapter.quote("StartDate") }} as starts_at_utc,
{{ adapter.quote("EndDate") }} as ends_at_utc,
case
when {{ adapter.quote("EndDate") }} is null then true else false
end as has_no_end_date,
{{ adapter.quote("CreatedDate") }} as created_at_utc,
cast({{ adapter.quote("CreatedDate") }} as date) as created_date_utc,
{{ adapter.quote("UpdatedDate") }} as updated_at_utc,
cast({{ adapter.quote("UpdatedDate") }} as date) as updated_date_utc,
{{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at
from raw_accommodation_to_product_bundle
)
select *
from stg_core__accommodation_to_product_bundle