diff --git a/models/intermediate/core/schema.yaml b/models/intermediate/core/schema.yaml index c77c05a..38405f0 100644 --- a/models/intermediate/core/schema.yaml +++ b/models/intermediate/core/schema.yaml @@ -2292,7 +2292,7 @@ models: Important: 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 Product Bundles she/he can apply into a Listing. @@ -2331,7 +2331,7 @@ models: data_type: int description: | 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 data_type: string @@ -2347,7 +2347,6 @@ models: data_type: boolean description: | 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 data_type: int diff --git a/models/staging/core/_core_sources.yml b/models/staging/core/_core_sources.yml index f03d035..979f2ff 100644 --- a/models/staging/core/_core_sources.yml +++ b/models/staging/core/_core_sources.yml @@ -229,3 +229,5 @@ sources: identifier: AddressValidation - name: VerificationToAddressValidation identifier: VerificationToAddressValidation + - name: AccommodationToProductBundle + identifier: AccommodationToProductBundle \ No newline at end of file diff --git a/models/staging/core/schema.yml b/models/staging/core/schema.yml index 3985ff4..bac53e6 100644 --- a/models/staging/core/schema.yml +++ b/models/staging/core/schema.yml @@ -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 \ No newline at end of file diff --git a/models/staging/core/stg_core__accommodation_to_product_bundle.sql b/models/staging/core/stg_core__accommodation_to_product_bundle.sql new file mode 100644 index 0000000..0a0b1db --- /dev/null +++ b/models/staging/core/stg_core__accommodation_to_product_bundle.sql @@ -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