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:
Joaquin Ossa 2024-12-23 09:09:13 +00:00
commit 3b17fa231e
8 changed files with 56 additions and 26 deletions

View file

@ -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

View file

@ -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: ""

View file

@ -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,

View file

@ -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