add staging model

This commit is contained in:
Pablo Martin 2024-08-12 11:00:13 +02:00
parent e4b0f54241
commit 51fd0cf3bc

View 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 is_active,
{{ 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_extract_at
from raw_user_product_bundle
)
select *
from stg_core__user_product_bundle