Merged PR 2540: Add UserProductBundle to staging
# Description Adds Core's `UserProductBundle` table to `staging`. # 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: #19570
This commit is contained in:
commit
cb3cf24b60
4 changed files with 74 additions and 0 deletions
|
|
@ -221,3 +221,7 @@ sources:
|
||||||
identifier: Role
|
identifier: Role
|
||||||
- name: Claim
|
- name: Claim
|
||||||
identifier: Claim
|
identifier: Claim
|
||||||
|
- name: UserProductBundle
|
||||||
|
identifier: UserProductBundle
|
||||||
|
- name: BookingToProductBundle
|
||||||
|
identifier: BookingToProductBundle
|
||||||
|
|
|
||||||
|
|
@ -160,3 +160,15 @@ models:
|
||||||
tests:
|
tests:
|
||||||
- unique
|
- unique
|
||||||
- not_null
|
- not_null
|
||||||
|
- name: stg_core__user_product_bundle
|
||||||
|
columns:
|
||||||
|
- name: id_user_product_bundle
|
||||||
|
tests:
|
||||||
|
- unique
|
||||||
|
- not_null
|
||||||
|
- name: stg_core__booking_to_product_bundle
|
||||||
|
columns:
|
||||||
|
- name: id_booking_to_product_bundle
|
||||||
|
tests:
|
||||||
|
- unique
|
||||||
|
- not_null
|
||||||
26
models/staging/core/stg_core__booking_to_product_bundle.sql
Normal file
26
models/staging/core/stg_core__booking_to_product_bundle.sql
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
with
|
||||||
|
raw_booking_to_product_bundle as (
|
||||||
|
select * from {{ source("core", "BookingToProductBundle") }}
|
||||||
|
),
|
||||||
|
stg_core__booking_to_product_bundle as (
|
||||||
|
select
|
||||||
|
{{ adapter.quote("Id") }} as id_booking_to_product_bundle,
|
||||||
|
{{ adapter.quote("BookingId") }} as id_booking,
|
||||||
|
{{ 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_booking_to_product_bundle
|
||||||
|
)
|
||||||
|
select *
|
||||||
|
from stg_core__booking_to_product_bundle
|
||||||
32
models/staging/core/stg_core__user_product_bundle.sql
Normal file
32
models/staging/core/stg_core__user_product_bundle.sql
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
with
|
||||||
|
raw_user_product_bundle as (
|
||||||
|
select * from {{ source("core", "UserProductBundle") }}
|
||||||
|
),
|
||||||
|
stg_core__user_product_bundle as (
|
||||||
|
select
|
||||||
|
{{ adapter.quote("Id") }} as id_user_product_bundle,
|
||||||
|
{{ adapter.quote("SuperhogUserId") }} as id_user,
|
||||||
|
{{ adapter.quote("ProductBundleId") }} as id_product_bundle,
|
||||||
|
{{ adapter.quote("ProtectionPlanId") }} as id_protection_plan,
|
||||||
|
|
||||||
|
{{ adapter.quote("Name") }} as product_bundle_name,
|
||||||
|
{{ adapter.quote("DisplayName") }} as product_bundle_display_name,
|
||||||
|
{{ adapter.quote("DisplayOnFrontEnd") }} as display_on_front_end,
|
||||||
|
{{ adapter.quote("ChosenProductServices") }} as chosen_product_services,
|
||||||
|
|
||||||
|
{{ 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_user_product_bundle
|
||||||
|
)
|
||||||
|
select *
|
||||||
|
from stg_core__user_product_bundle
|
||||||
Loading…
Add table
Add a link
Reference in a new issue