Merged PR 2676: Propagates Billing Country information

# Description

Propagates Billing Country information in unified_user and user_host intermediate models. This is a necessary step towards providing KPIs segmented by Billing Country.

# 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.

Related work items: #19082
This commit is contained in:
Oriol Roqué Paniagua 2024-08-29 08:25:05 +00:00
parent 0137179396
commit 2f77c8eea8
3 changed files with 26 additions and 3 deletions

View file

@ -1,12 +1,16 @@
with
stg_core__user as (select * from {{ ref("stg_core__user") }}),
stg_core__superhog_user as (select * from {{ ref("stg_core__superhog_user") }}),
stg_core__currency as (select * from {{ ref("stg_core__currency") }})
stg_core__currency as (select * from {{ ref("stg_core__currency") }}),
stg_core__country as (select * from {{ ref("stg_core__country") }})
select
u.id_user,
u.id_account_type,
u.id_billing_country,
c.iso4217_code as account_currency_iso4217,
co.country_name as billing_country_name,
co.iso_2 as billing_country_iso_2,
co.iso_3 as billing_country_iso_3,
cu.iso4217_code as account_currency_iso4217,
u.user_code,
u.first_name,
u.last_name,
@ -42,4 +46,5 @@ select
su.id_user_verification_status
from stg_core__user as u
inner join stg_core__superhog_user as su on u.id_user = su.id_superhoguser
left join stg_core__currency c on u.id_account_currency = c.id_currency
left join stg_core__currency cu on u.id_account_currency = cu.id_currency
left join stg_core__country co on u.id_billing_country = co.id_country

View file

@ -31,6 +31,9 @@ select
uu.id_user as id_user_host,
uu.id_account_type,
uu.id_billing_country,
uu.billing_country_name,
uu.billing_country_iso_2,
uu.billing_country_iso_3,
uu.account_currency_iso4217,
uu.user_code,
uu.first_name,

View file

@ -2111,6 +2111,21 @@ models:
description: |
ID of the country in which the Host is billed.
In some cases it's null.
- name: billing_country_name
data_type: string
description: |
Name of the country in which the Host is billed.
In some cases it's null.
- name: billing_country_iso_2
data_type: string
description: |
ISO 3166-1 alpha-2 country code in which the Host is billed.
In some cases it's null.
- name: billing_country_iso_3
data_type: string
description: |
ISO 3166-1 alpha-3 country code in which the Host is billed.
In some cases it's null.
- name: account_currency_iso4217
data_type: string
description: |