Merged PR 2077: Adding Country to intermediate

Adding Country to intermediate, both model + documentation.

At this stage, the model is set as a view but we can discuss what is the best approach

Related work items: #17312
This commit is contained in:
Oriol Roqué Paniagua 2024-06-19 15:34:15 +00:00
parent 4a80625eeb
commit 839e5fae1b
2 changed files with 84 additions and 0 deletions

View file

@ -0,0 +1,16 @@
with
stg_core__country as (select * from {{ ref("stg_core__country") }}),
stg_core__currency as (select * from {{ ref("stg_core__currency") }})
select
co.id_country,
co.iso_2,
co.iso_3,
co.country_name,
co.iso_num_code,
co.phone_code,
co.id_preferred_currency,
cu.currency_name as preferred_currency_name,
cu.iso4217_code as preferred_iso4217_code,
co.dwh_extracted_at_utc
from stg_core__country as co
left join stg_core__currency cu on cu.id_currency = co.id_preferred_currency

View file

@ -430,4 +430,72 @@ models:
data_type: character varying
- name: notes
data_type: character varying
- name: int_core__country
description: |
This model contains information regarding countries, such as codes,
names and preferred currencies
columns:
- name: id_country
data_type: bigint
description: id of the country. It's the unique key for this model.
tests:
- not_null
- unique
- name: iso_2
data_type: char(2)
description: ISO 3166-1 alpha-2 country code. Cannot be null.
tests:
- not_null
- name: iso_3
data_type: char(3)
description: |
ISO 3166-1 alpha-3 country code. Some countries can have this value as not set,
therefore it's nullable.
- name: country_name
data_type: character varying
description: name of the country. Cannot be null.
tests:
- not_null
- name: iso_num_code
data_type: int
description: |
ISO 3166-1 numeric code. Usually it's 3 digits, but since it's categorised as
an integer, the preceding zeros are removed. Nullable.
- name: phone_code
data_type: int
description: |
Phone code prefix for a given country. Can contain default / duplicated values.
- name: id_preferred_currency
data_type: int
description: |
Id of the preferred currency for a given country. Might not be the only currency
used in the country, it's just the preferred one.
tests:
- not_null
- name: preferred_currency_name
data_type: character varying
description: |
Currency name of the preferred currency for a given country.
tests:
- not_null
- name: preferred_iso4217_code
data_type: char(3)
description: |
Three-letter code assigned to the preferred currency for a given country by the ISO.
These codes are part of the ISO 4217 standard.
tests:
- not_null