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

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

View file

@ -185,6 +185,12 @@ models:
- unique
- not_null
- name: id_address_validation
tests:
- unique
- not_null
- name: stg_core__accommodation_to_product_bundle
columns:
- name: id_accommodation_to_product_bundle
tests:
- unique
- 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