Added booking fee and currency to model

This commit is contained in:
Joaquin Ossa 2025-01-15 09:00:36 +01:00
parent ae4f656d54
commit 28f7486634
4 changed files with 27 additions and 1 deletions

View file

@ -12,6 +12,8 @@ select
c.id_reservation,
c.id_accommodation,
chu.id_currency,
chu.currency_code,
chu.booking_fee_in_local_currency,
c.guest_last_name,
c.guest_first_name,
c.guest_email,

View file

@ -41,6 +41,21 @@ models:
to: ref('stg_core__currency')
field: id_currency
- name: currency_code
data_type: character varying
description: Currency ISO 4217 code used by user.
data_tests:
- not_null
- name: booking_fee_in_local_currency
data_type: numeric
description: "Fee charged to the user for each booking in the local currency."
data_tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
max_value: 1000
strictly: true
- name: guest_last_name
data_type: text
description: Last name of the guest checking in.

View file

@ -3,11 +3,13 @@
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__user as (select * from {{ ref("stg_core__user") }})
stg_core__user as (select * from {{ ref("stg_core__user") }}),
stg_core__currency as (select * from {{ ref("stg_core__currency") }})
select
au.id_apim_user,
au.id_apim_user_type,
u.id_account_currency as id_currency,
c.iso4217_code as currency_code,
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,
@ -24,3 +26,4 @@ inner join
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
inner join stg_core__currency c on u.id_account_currency = c.id_currency

View file

@ -4771,6 +4771,12 @@ models:
to: ref('stg_core__currency')
field: id_currency
- name: currency_code
data_type: character varying
description: Currency ISO 4217 code used by user.
data_tests:
- not_null
- name: id_deal
data_type: text
description: ""