Merged PR 3879: Feedback on current process
# Description Rename changes and adding some necessary fields like `id_currency` to some S&P models # 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. Feedback on current process Related work items: #25360
This commit is contained in:
commit
3b17fa231e
8 changed files with 56 additions and 26 deletions
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
with
|
||||
stg_core__apim_user as (select * from {{ ref("stg_core__apim_user") }}),
|
||||
stg_core__apim_user_type as (select * from {{ ref("stg_core__apim_user_type") }})
|
||||
stg_core__apim_user_type as (select * from {{ ref("stg_core__apim_user_type") }}),
|
||||
stg_core__user as (select * from {{ ref("stg_core__user") }})
|
||||
select
|
||||
-- note that these ids are not the same as the ones found in Core
|
||||
-- they are completely unrelated
|
||||
au.id_apim_user,
|
||||
au.id_apim_user_type,
|
||||
u.id_account_currency as id_currency,
|
||||
au.json_document_user_data ->> 'DealId' as id_deal,
|
||||
au.json_document_user_data ->> 'AccountType' as account_type,
|
||||
au.json_document_user_data ->> 'ClientMarkup' as client_markup,
|
||||
|
|
@ -44,3 +44,4 @@ inner join
|
|||
stg_core__apim_user_type aut
|
||||
on au.id_apim_user_type = aut.id_apim_user_type
|
||||
and upper(aut.user_type_name) = '{{ api_name }}'
|
||||
inner join stg_core__user u on au.id_apim_user = u.id_user
|
||||
|
|
|
|||
|
|
@ -4590,6 +4590,16 @@ models:
|
|||
data_type: bigint
|
||||
description: "Identifier of the type of user."
|
||||
|
||||
- name: id_currency
|
||||
data_type: bigint
|
||||
description: "Id of the currency, works as a foreign key to the
|
||||
currency table"
|
||||
tests:
|
||||
- not_null
|
||||
- relationships:
|
||||
to: ref('stg_core__currency')
|
||||
field: id_currency
|
||||
|
||||
- name: id_deal
|
||||
data_type: text
|
||||
description: ""
|
||||
|
|
|
|||
|
|
@ -6,17 +6,16 @@ with
|
|||
select * from {{ ref("int_core__screen_and_protect_users") }}
|
||||
)
|
||||
select
|
||||
-- note that these ids are not the same as the ones found in Core
|
||||
-- they are completely unrelated
|
||||
vr.id_verification,
|
||||
vr.id_booking,
|
||||
vr.id_user_partner,
|
||||
vr.id_accommodation,
|
||||
spu.id_currency,
|
||||
spu.is_protected,
|
||||
vr.protection_type,
|
||||
vr.protection_starting_level,
|
||||
vr.protection_basic_amount,
|
||||
vr.protection_extended_amount,
|
||||
vr.protection_starting_amount_in_local_currency,
|
||||
vr.protection_basic_amount_in_local_currency,
|
||||
vr.protection_extended_amount_in_local_currency,
|
||||
vr.pet_protection,
|
||||
vr.verification_status,
|
||||
vr.verification_status_reason,
|
||||
|
|
|
|||
|
|
@ -35,6 +35,16 @@ models:
|
|||
data_type: text
|
||||
description: Identifier for the accommodation related to the booking.
|
||||
|
||||
- name: id_currency
|
||||
data_type: bigint
|
||||
description: "Id of the currency, works as a foreign key to the
|
||||
currency table"
|
||||
tests:
|
||||
- not_null
|
||||
- relationships:
|
||||
to: ref('stg_core__currency')
|
||||
field: id_currency
|
||||
|
||||
- name: is_protected
|
||||
data_type: boolean
|
||||
description: |
|
||||
|
|
@ -55,30 +65,33 @@ models:
|
|||
- "DAMAGE WAIVER"
|
||||
- "PET PROTECTION"
|
||||
|
||||
- name: protection_starting_level
|
||||
- name: protection_starting_amount_in_local_currency
|
||||
data_type: numeric
|
||||
description: Field used for protection type "STANDALONE PROTECTION" to
|
||||
indicate the starting level of protection.
|
||||
In local currency.
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
max_value: 100000
|
||||
strictly: true
|
||||
|
||||
- name: protection_basic_amount
|
||||
- name: protection_basic_amount_in_local_currency
|
||||
data_type: numeric
|
||||
description: Field used for protection type "SCREEN & PROTECT",
|
||||
"BASIC PROTECTION" or "DAMAGE WAIVER" to show the basic amount of protection.
|
||||
In local currency.
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
max_value: 100000
|
||||
strictly: true
|
||||
|
||||
- name: protection_extended_amount
|
||||
- name: protection_extended_amount_in_local_currency
|
||||
data_type: numeric
|
||||
description: Field used for protection type "SCREEN & PROTECT",
|
||||
or "STANDALONE PROTECTION" to show the basic amount of protection.
|
||||
In local currency.
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
|
|
|
|||
|
|
@ -50,30 +50,33 @@ models:
|
|||
- "DAMAGE WAIVER"
|
||||
- "PET PROTECTION"
|
||||
|
||||
- name: protection_starting_level
|
||||
- name: protection_starting_amount_in_local_currency
|
||||
data_type: numeric
|
||||
description: Field used for protection type "STANDALONE PROTECTION" to
|
||||
indicate the starting level of protection.
|
||||
In local currency.
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
max_value: 100000
|
||||
strictly: true
|
||||
|
||||
- name: protection_basic_amount
|
||||
- name: protection_basic_amount_in_local_currency
|
||||
data_type: numeric
|
||||
description: Field used for protection type "SCREEN & PROTECT",
|
||||
"BASIC PROTECTION" or "DAMAGE WAIVER" to show the basic amount of protection.
|
||||
In local currency.
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
max_value: 100000
|
||||
strictly: true
|
||||
|
||||
- name: protection_extended_amount
|
||||
- name: protection_extended_amount_in_local_currency
|
||||
data_type: numeric
|
||||
description: Field used for protection type "SCREEN & PROTECT",
|
||||
or "STANDALONE PROTECTION" to show the basic amount of protection.
|
||||
In local currency.
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
|
|
|
|||
|
|
@ -3,17 +3,18 @@ with
|
|||
select * from {{ ref("int_screen_and_protect__verification_requests") }}
|
||||
)
|
||||
select
|
||||
-- note that these ids are not the same as the ones found in Core DWH
|
||||
-- they are completely unrelated
|
||||
id_verification as id_verification,
|
||||
id_booking as id_booking,
|
||||
id_user_partner as id_user_partner,
|
||||
id_accommodation as id_accommodation,
|
||||
is_protected as is_protected,
|
||||
protection_type as protection_type,
|
||||
protection_starting_level as protection_starting_level,
|
||||
protection_basic_amount as protection_basic_amount,
|
||||
protection_extended_amount as protection_extended_amount,
|
||||
protection_starting_amount_in_local_currency
|
||||
as protection_starting_amount_in_local_currency,
|
||||
protection_basic_amount_in_local_currency
|
||||
as protection_basic_amount_in_local_currency,
|
||||
protection_extended_amount_in_local_currency
|
||||
as protection_extended_amount_in_local_currency,
|
||||
pet_protection as pet_protection,
|
||||
verification_status as verification_status,
|
||||
verification_status_reason as verification_status_reason,
|
||||
|
|
|
|||
|
|
@ -43,30 +43,33 @@ models:
|
|||
- "DAMAGE WAIVER"
|
||||
- "PET PROTECTION"
|
||||
|
||||
- name: protection_starting_level
|
||||
- name: protection_starting_amount_in_local_currency
|
||||
data_type: numeric
|
||||
description: Field used for protection type "STANDALONE PROTECTION" to
|
||||
indicate the starting level of protection.
|
||||
indicate the starting amount of protection.
|
||||
In local currency.
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
max_value: 100000
|
||||
strictly: true
|
||||
|
||||
- name: protection_basic_amount
|
||||
- name: protection_basic_amount_in_local_currency
|
||||
data_type: numeric
|
||||
description: Field used for protection type "SCREEN & PROTECT",
|
||||
"BASIC PROTECTION" or "DAMAGE WAIVER" to show the basic amount of protection.
|
||||
In local currency.
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
max_value: 100000
|
||||
strictly: true
|
||||
|
||||
- name: protection_extended_amount
|
||||
- name: protection_extended_amount_in_local_currency
|
||||
data_type: numeric
|
||||
description: Field used for protection type "SCREEN & PROTECT",
|
||||
or "STANDALONE PROTECTION" to show the basic amount of protection.
|
||||
In local currency.
|
||||
tests:
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ with
|
|||
then null
|
||||
else {{ adapter.quote("documents") }} ->> 'ProtectionStartingLevel'
|
||||
end as decimal(19, 4)
|
||||
) as protection_starting_level,
|
||||
) as protection_starting_amount_in_local_currency,
|
||||
cast(
|
||||
case
|
||||
when
|
||||
|
|
@ -31,7 +31,7 @@ with
|
|||
then null
|
||||
else {{ adapter.quote("documents") }} ->> 'ProtectionBasicAmount'
|
||||
end as decimal(19, 4)
|
||||
) as protection_basic_amount,
|
||||
) as protection_basic_amount_in_local_currency,
|
||||
cast(
|
||||
case
|
||||
when
|
||||
|
|
@ -40,7 +40,7 @@ with
|
|||
then null
|
||||
else {{ adapter.quote("documents") }} ->> 'ProtectionExtendedAmount'
|
||||
end as decimal(19, 4)
|
||||
) as protection_extended_amount,
|
||||
) as protection_extended_amount_in_local_currency,
|
||||
({{ adapter.quote("documents") }} ->> 'PetProtection')::boolean
|
||||
as pet_protection,
|
||||
upper({{ adapter.quote("documents") }} ->> 'Status') as verification_status,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue