Merged PR 4685: Guest Products - sync core tables
# Description Adds `VerificationRequestGuestProductToPayment` and `VerificationRequestToGuestProduct` to staging. Note these tables are empty thus it's possible that some tests might need to be adapted in the future. I also already added the configuration for sync_guest_product sources. # 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. Guest Products - sync core tables Related work items: #28490
This commit is contained in:
parent
9ca9c827fe
commit
7ef460a59e
4 changed files with 230 additions and 0 deletions
|
|
@ -277,3 +277,23 @@ sources:
|
|||
identifier: StandaloneProtection
|
||||
- name: AccountType
|
||||
identifier: AccountType
|
||||
- name: VerificationRequestToGuestProduct
|
||||
identifier: VerificationRequestToGuestProduct
|
||||
- name: VerificationRequestGuestProductToPayment
|
||||
identifier: VerificationRequestGuestProductToPayment
|
||||
|
||||
- name: guest_product
|
||||
schema: sync_guest_product
|
||||
tables:
|
||||
- name: Product
|
||||
identifier: Product
|
||||
- name: Configuration
|
||||
identifier: Configuration
|
||||
- name: ConfigurationStatus
|
||||
identifier: ConfigurationStatus
|
||||
- name: ConfigurationLevel
|
||||
identifier: ConfigurationLevel
|
||||
- name: ConfigurationPricePlan
|
||||
identifier: ConfigurationPricePlan
|
||||
- name: DisplayDetail
|
||||
identifier: DisplayDetail
|
||||
|
|
|
|||
|
|
@ -1861,3 +1861,141 @@ models:
|
|||
Timestamp of when this record was extracted into DWH.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: stg_core__verification_request_to_guest_product
|
||||
description: |
|
||||
Contains the relationship between a Verification Request and a Guest Product.
|
||||
This table is used to track the verification requests that are related to a
|
||||
specific guest product.
|
||||
|
||||
columns:
|
||||
- name: id_verification_request_to_guest_product
|
||||
data_type: bigint
|
||||
description: |
|
||||
Unique identifier of the verification request to guest product.
|
||||
Acts as the primary key for this table.
|
||||
data_tests:
|
||||
- not_null
|
||||
- unique
|
||||
|
||||
- name: id_verification_request
|
||||
data_type: bigint
|
||||
description: |
|
||||
Identifier of the verification request.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: id_guest_product
|
||||
data_type: bigint
|
||||
description: |
|
||||
Identifier of the guest product.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: id_guest_product_configuration_price_plan
|
||||
data_type: bigint
|
||||
description: |
|
||||
Identifier of the guest product configuration price plan.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: is_guest_product_purchased
|
||||
data_type: boolean
|
||||
description: |
|
||||
Indicates if the guest product was purchased.
|
||||
|
||||
- name: created_at_utc
|
||||
data_type: timestamp with time zone
|
||||
description: |
|
||||
Timestamp of when this record was created.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: created_date_utc
|
||||
data_type: date
|
||||
description: |
|
||||
Date of when this record was created.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: updated_at_utc
|
||||
data_type: timestamp with time zone
|
||||
description: |
|
||||
Timestamp of when this record was last updated.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: updated_date_utc
|
||||
data_type: date
|
||||
description: |
|
||||
Date of when this record was last updated.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: dwh_extracted_at_utc
|
||||
data_type: timestamp with time zone
|
||||
description: |
|
||||
Timestamp of when this record was extracted into DWH.
|
||||
|
||||
- name: stg_core__verification_request_guest_product_to_payment
|
||||
description: |
|
||||
Contains the relationship between a Verification Request with Guest Product and a Payment.
|
||||
This table is used to track the verification requests from a guest product
|
||||
to a payment.
|
||||
|
||||
columns:
|
||||
- name: id_verification_request_guest_product_to_payment
|
||||
data_type: bigint
|
||||
description: |
|
||||
Unique identifier of the verification request to guest product to payment.
|
||||
Acts as the primary key for this table.
|
||||
data_tests:
|
||||
- not_null
|
||||
- unique
|
||||
|
||||
- name: id_verification_request_to_guest_product
|
||||
data_type: bigint
|
||||
description: |
|
||||
Identifier of the verification request to guest product.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: id_payment
|
||||
data_type: bigint
|
||||
description: |
|
||||
Identifier of the payment.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: created_at_utc
|
||||
data_type: timestamp with time zone
|
||||
description: |
|
||||
Timestamp of when this record was created.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: created_date_utc
|
||||
data_type: date
|
||||
description: |
|
||||
Date of when this record was created.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: updated_at_utc
|
||||
data_type: timestamp with time zone
|
||||
description: |
|
||||
Timestamp of when this record was last updated.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: updated_date_utc
|
||||
data_type: date
|
||||
description: |
|
||||
Date of when this record was last updated.
|
||||
data_tests:
|
||||
- not_null
|
||||
|
||||
- name: dwh_extracted_at_utc
|
||||
data_type: timestamp with time zone
|
||||
description: |
|
||||
Timestamp of when this record was extracted into DWH.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
{{
|
||||
config(
|
||||
materialized="incremental",
|
||||
unique_key="id_verification_request_to_guest_product",
|
||||
)
|
||||
}}
|
||||
|
||||
|
||||
with
|
||||
raw_verification_request_guest_product_to_payment as (
|
||||
select * from {{ source("core", "VerificationRequestGuestProductToPayment") }}
|
||||
),
|
||||
stg_core__verification_request_guest_product_to_payment as (
|
||||
select
|
||||
{{ adapter.quote("Id") }}
|
||||
as id_verification_request_guest_product_to_payment,
|
||||
{{ adapter.quote("PaymentId") }} as id_payment,
|
||||
{{ adapter.quote("VerificationRequestToGuestProductId") }}
|
||||
as id_verification_request_to_guest_product,
|
||||
|
||||
{{ 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_utc
|
||||
|
||||
from raw_verification_request_guest_product_to_payment
|
||||
)
|
||||
select *
|
||||
from stg_core__verification_request_guest_product_to_payment
|
||||
{% if is_incremental() %}
|
||||
where
|
||||
updated_at_utc
|
||||
>= ((select max(updated_at_utc) from {{ this }}) - interval '7 days')
|
||||
{% endif %}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
{{
|
||||
config(
|
||||
materialized="incremental",
|
||||
unique_key="id_verification_request_to_guest_product",
|
||||
)
|
||||
}}
|
||||
|
||||
|
||||
with
|
||||
raw_verification_request_to_guest_product as (
|
||||
select * from {{ source("core", "VerificationRequestToGuestProduct") }}
|
||||
),
|
||||
stg_core__verification_request_to_guest_product as (
|
||||
select
|
||||
{{ adapter.quote("Id") }} as id_verification_request_to_guest_product,
|
||||
{{ adapter.quote("GuestProductId") }} as id_guest_product,
|
||||
{{ adapter.quote("VerificationRequestId") }} as id_verification_request,
|
||||
{{ adapter.quote("GuestProductConfigurationPricePlanId") }}
|
||||
as id_guest_product_configuration_price_plan,
|
||||
|
||||
{{ adapter.quote("PurchasedByGuest") }} as is_guest_product_purchased,
|
||||
|
||||
{{ 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_utc
|
||||
|
||||
from raw_verification_request_to_guest_product
|
||||
)
|
||||
select *
|
||||
from stg_core__verification_request_to_guest_product
|
||||
{% if is_incremental() %}
|
||||
where
|
||||
updated_at_utc
|
||||
>= ((select max(updated_at_utc) from {{ this }}) - interval '7 days')
|
||||
{% endif %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue