2024-06-14 15:48:24 +02:00
|
|
|
models:
|
|
|
|
|
- name: int_daily_currency_exchange_rates
|
|
|
|
|
description: >-
|
|
|
|
|
This model holds a lot of data on currency exchange rates. The time
|
|
|
|
|
granularity is daily. Each record holds a currency pair for a specific
|
|
|
|
|
day, source and version.
|
|
|
|
|
|
2024-06-14 16:22:00 +02:00
|
|
|
Actual rates are sourced from xe.com data. The `guessed` and `forecast`
|
2024-06-14 15:48:24 +02:00
|
|
|
versions are built by simply 'pushing' the first/last exchange rate on
|
|
|
|
|
record. Basically, wherever we dont' have data for a date, we pick the
|
2024-06-14 16:22:00 +02:00
|
|
|
closest actual data point that comes from xe.com. Bear in mind this means
|
|
|
|
|
that `forecast` version records will change on a daily basis as actual
|
|
|
|
|
data moves forwards, meaning you shouldn't assume your money amounts
|
|
|
|
|
converted in the future should always stay put.
|
2024-06-14 15:48:24 +02:00
|
|
|
|
|
|
|
|
Note that, given the dimensionality, getting a simple time series for a
|
|
|
|
|
currency pair will require a bit of filtering.
|
|
|
|
|
|
|
|
|
|
Reverse rates are explicit. This means that, for any given day and any
|
|
|
|
|
given currency pair, you will find two records with opposite from/to
|
|
|
|
|
positions. So, for 2024-01-01, you will find both a EUR->USD record and a
|
|
|
|
|
USD->EUR record with the opposite rate (1/rate).
|
|
|
|
|
columns:
|
|
|
|
|
- name: id_exchange_rate
|
|
|
|
|
data_type: text
|
|
|
|
|
description: A unique ID for the record, derived from concatenating the
|
|
|
|
|
currencies, date, source and version. Currency order is relevant
|
|
|
|
|
(EURUSD != USDEUR).
|
|
|
|
|
tests:
|
|
|
|
|
- not_null
|
|
|
|
|
- unique
|
|
|
|
|
- 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 target currency, represented as an ISO 4217 code.
|
|
|
|
|
tests:
|
|
|
|
|
- not_null
|
|
|
|
|
- name: rate
|
|
|
|
|
data_type: numeric
|
|
|
|
|
description: >-
|
|
|
|
|
The exchange rate, represented as the units of the target currency
|
|
|
|
|
that one unit of source currency gets you. So, from_currency=USD to
|
|
|
|
|
to_currency=PLN with rate=4.2 should be read as '1 US Dollar buys me
|
|
|
|
|
4.2 Polish Zlotys'.
|
|
|
|
|
|
|
|
|
|
For same currency pairs (EUR to EUR, USD to USD, etc). The rate will
|
|
|
|
|
always be one.
|
|
|
|
|
|
|
|
|
|
The rate can be smaller than one, but can't be negative.
|
|
|
|
|
tests:
|
|
|
|
|
- not_negative_or_zero
|
|
|
|
|
- not_null
|
|
|
|
|
- name: rate_date_utc
|
|
|
|
|
data_type: date
|
|
|
|
|
description: The date in which the rate record is relevant.
|
|
|
|
|
tests:
|
|
|
|
|
- not_null
|
|
|
|
|
- name: source
|
|
|
|
|
data_type: text
|
2024-06-14 16:46:28 +02:00
|
|
|
description:
|
|
|
|
|
Where is the data coming from. Records that are composed from
|
2024-06-14 15:48:24 +02:00
|
|
|
making assumptions on real data will contain `_inferred`.
|
|
|
|
|
- name: rate_version
|
|
|
|
|
data_type: text
|
2024-06-14 16:46:28 +02:00
|
|
|
description:
|
|
|
|
|
The version of the rate. This can be one of `actual` (the rate is a
|
2024-06-14 15:48:24 +02:00
|
|
|
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
|
|
|
|
|
nature). Note that one currency pair can have multiple rate versions
|
|
|
|
|
on the same date.
|
|
|
|
|
tests:
|
|
|
|
|
- accepted_values:
|
|
|
|
|
values:
|
|
|
|
|
- guess
|
|
|
|
|
- actual
|
|
|
|
|
- forecast
|
2024-06-14 16:22:00 +02:00
|
|
|
- not_null
|
2024-06-14 15:48:24 +02:00
|
|
|
- name: updated_at_utc
|
|
|
|
|
data_type: timestamp with time zone
|
2024-06-14 16:46:28 +02:00
|
|
|
description:
|
|
|
|
|
For external sources, this will be the point in time when the
|
2024-06-14 15:48:24 +02:00
|
|
|
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
|
2024-06-14 16:44:48 +02:00
|
|
|
- name: int_simple_exchange_rates
|
2024-06-14 16:46:28 +02:00
|
|
|
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
|
2024-06-14 16:44:48 +02:00
|
|
|
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
|
2024-06-14 16:46:28 +02:00
|
|
|
description:
|
|
|
|
|
For external sources, this will be the point in time when the
|
2024-06-14 16:44:48 +02:00
|
|
|
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
|
2024-07-05 15:01:21 +00:00
|
|
|
|
|
|
|
|
- name: int_mtd_guest_revenue_metrics
|
|
|
|
|
description: |
|
|
|
|
|
This model contains the historic information regarding the guest revenue in an aggregated manner.
|
|
|
|
|
It's used for the business KPIs. Data is aggregated at the last day of the month and in the
|
|
|
|
|
days necessary for the Month-to-Date computation of the current month.
|
|
|
|
|
|
|
|
|
|
columns:
|
|
|
|
|
- name: date
|
|
|
|
|
data_type: date
|
|
|
|
|
description: The date for the month-to-date guest revenue-related metrics.
|
|
|
|
|
tests:
|
|
|
|
|
- not_null
|
|
|
|
|
- unique
|
|
|
|
|
|
|
|
|
|
- name: int_monthly_guest_revenue_history_by_deal
|
|
|
|
|
description: |
|
|
|
|
|
This model contains the historic information regarding the guest revenue for each deal id.
|
|
|
|
|
It's used for the business KPIs in the view by deal id. Data is aggregated at the last
|
|
|
|
|
day of the month, or up to yesterday if it's the current month.
|
|
|
|
|
tests:
|
|
|
|
|
- dbt_utils.unique_combination_of_columns:
|
|
|
|
|
combination_of_columns:
|
|
|
|
|
- date
|
|
|
|
|
- id_deal
|
|
|
|
|
|
|
|
|
|
columns:
|
|
|
|
|
- name: date
|
|
|
|
|
data_type: date
|
|
|
|
|
description: The last day of the month or yesterday for historic guest revenue metrics.
|
|
|
|
|
tests:
|
|
|
|
|
- not_null
|
|
|
|
|
|
|
|
|
|
- name: id_deal
|
|
|
|
|
data_type: character varying
|
|
|
|
|
description: Id of the deal associated to the host.
|
|
|
|
|
tests:
|
|
|
|
|
- not_null
|