add staging model

This commit is contained in:
Pablo Martin 2024-08-12 11:18:49 +02:00
parent 501a063635
commit a39f4d24aa

View 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