Merged PR 2039: Simple rates
- Creates a simplified rates model that hides some of the complexities of the full blown exchange rates model. Related work items: #17212
This commit is contained in:
commit
f900ca794f
3 changed files with 59 additions and 3 deletions
7
models/intermediate/cross/int_simple_exchange_rates.sql
Normal file
7
models/intermediate/cross/int_simple_exchange_rates.sql
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
with
|
||||||
|
int_daily_currency_exchange_rates as (
|
||||||
|
select * from {{ ref("int_daily_currency_exchange_rates") }}
|
||||||
|
)
|
||||||
|
select er.from_currency, er.to_currency, er.rate, er.rate_date_utc, er.updated_at_utc
|
||||||
|
from int_daily_currency_exchange_rates er
|
||||||
|
where er.source = 'xedotcom' or er.source = 'xe_inferred'
|
||||||
|
|
@ -61,11 +61,13 @@ models:
|
||||||
- not_null
|
- not_null
|
||||||
- name: source
|
- name: source
|
||||||
data_type: text
|
data_type: text
|
||||||
description: Where is the data coming from. Records that are composed from
|
description:
|
||||||
|
Where is the data coming from. Records that are composed from
|
||||||
making assumptions on real data will contain `_inferred`.
|
making assumptions on real data will contain `_inferred`.
|
||||||
- name: rate_version
|
- name: rate_version
|
||||||
data_type: text
|
data_type: text
|
||||||
description: The version of the rate. This can be one of `actual` (the rate is a
|
description:
|
||||||
|
The version of the rate. This can be one of `actual` (the rate is a
|
||||||
reality fact), `forecast` (the rate sits in the future and is a guess
|
reality fact), `forecast` (the rate sits in the future and is a guess
|
||||||
in nature) or `guess` (the rate sits in the past and is a guess in
|
in nature) or `guess` (the rate sits in the past and is a guess in
|
||||||
nature). Note that one currency pair can have multiple rate versions
|
nature). Note that one currency pair can have multiple rate versions
|
||||||
|
|
@ -79,7 +81,52 @@ models:
|
||||||
- not_null
|
- not_null
|
||||||
- name: updated_at_utc
|
- name: updated_at_utc
|
||||||
data_type: timestamp with time zone
|
data_type: timestamp with time zone
|
||||||
description: For external sources, this will be the point in time when the
|
description:
|
||||||
|
For external sources, this will be the point in time when the
|
||||||
|
information was obtained from them. For stuff we make up here in the
|
||||||
|
DWH, this will be the point in time when we made the assumption.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
- name: int_simple_exchange_rates
|
||||||
|
description: >-
|
||||||
|
A simplified vision of exchange rates, derived from
|
||||||
|
`int_daily_currency_exchange_rates`. Come here if you don't want to
|
||||||
|
understand nuances and complexities and just want to convert rates.
|
||||||
|
|
||||||
|
The time granularity is daily. Each record holds a currency pair for a
|
||||||
|
specific day. You will only find one conversion rate per currency pair and
|
||||||
|
date.
|
||||||
|
tests:
|
||||||
|
- dbt_utils.unique_combination_of_columns:
|
||||||
|
combination_of_columns:
|
||||||
|
- from_currency
|
||||||
|
- to_currency
|
||||||
|
- rate_date_utc
|
||||||
|
columns:
|
||||||
|
- name: from_currency
|
||||||
|
data_type: character
|
||||||
|
description: The source currency, represented as an ISO 4217 code.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
- name: to_currency
|
||||||
|
data_type: character
|
||||||
|
description: The source currency, represented as an ISO 4217 code.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
- name: rate
|
||||||
|
data_type: numeric
|
||||||
|
description: The target currency, represented as an ISO 4217 code.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
- name: rate_date_utc
|
||||||
|
data_type: date
|
||||||
|
description: The date in which the rate record is relevant.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
- name: updated_at_utc
|
||||||
|
data_type: timestamp with time zone
|
||||||
|
description:
|
||||||
|
For external sources, this will be the point in time when the
|
||||||
information was obtained from them. For stuff we make up here in the
|
information was obtained from them. For stuff we make up here in the
|
||||||
DWH, this will be the point in time when we made the assumption.
|
DWH, this will be the point in time when we made the assumption.
|
||||||
tests:
|
tests:
|
||||||
|
|
|
||||||
|
|
@ -3,3 +3,5 @@ packages:
|
||||||
version: 0.12.1
|
version: 0.12.1
|
||||||
- package: calogica/dbt_expectations
|
- package: calogica/dbt_expectations
|
||||||
version: [">=0.9.0", "<0.10.0"]
|
version: [">=0.9.0", "<0.10.0"]
|
||||||
|
- package: dbt-labs/dbt_utils
|
||||||
|
version: 1.2.0
|
||||||
Loading…
Add table
Add a link
Reference in a new issue