Merged PR 2061: Deprecate hardcoded rates
This PR replaces the old hardcoded rates with the new ones from xe.com in the only model that used them. Related work items: #17493
This commit is contained in:
commit
361b1b6a7f
4 changed files with 3 additions and 116 deletions
|
|
@ -8,9 +8,7 @@ with
|
||||||
stg_core__verification as (select * from {{ ref("stg_core__verification") }}),
|
stg_core__verification as (select * from {{ ref("stg_core__verification") }}),
|
||||||
stg_core__payment as (select * from {{ ref("stg_core__payment") }}),
|
stg_core__payment as (select * from {{ ref("stg_core__payment") }}),
|
||||||
stg_core__payment_status as (select * from {{ ref("stg_core__payment_status") }}),
|
stg_core__payment_status as (select * from {{ ref("stg_core__payment_status") }}),
|
||||||
int_hardcoded_historical_currency_rates as (
|
int_simple_exchange_rates as (select * from {{ ref("int_simple_exchange_rates") }})
|
||||||
select * from {{ ref("int_hardcoded_historical_currency_rates") }}
|
|
||||||
)
|
|
||||||
select
|
select
|
||||||
vtp.id_verification_to_payment,
|
vtp.id_verification_to_payment,
|
||||||
vtp.id_payment,
|
vtp.id_payment,
|
||||||
|
|
@ -44,7 +42,7 @@ left join
|
||||||
on vtp.id_verification_payment_type = vpt.id_verification_payment_type
|
on vtp.id_verification_payment_type = vpt.id_verification_payment_type
|
||||||
left join stg_core__payment_status ps on p.id_payment_status = ps.id_payment_status
|
left join stg_core__payment_status ps on p.id_payment_status = ps.id_payment_status
|
||||||
left join
|
left join
|
||||||
int_hardcoded_historical_currency_rates r
|
int_simple_exchange_rates r
|
||||||
on p.paid_date_utc = r.rate_date
|
on vtp.payment_due_date_utc = r.rate_date_utc
|
||||||
and p.currency = r.from_currency
|
and p.currency = r.from_currency
|
||||||
and r.to_currency = 'GBP'
|
and r.to_currency = 'GBP'
|
||||||
|
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
with
|
|
||||||
hardcoded_rates as (select * from {{ ref("stg_seed__hardcoded_currency_rates") }}),
|
|
||||||
dates as (select * from {{ ref("int_dates") }})
|
|
||||||
select d.date_day as rate_date, r.*
|
|
||||||
from dates d
|
|
||||||
cross join hardcoded_rates r
|
|
||||||
where d.date_day > cast({{ var("start_date") }} as date)
|
|
||||||
|
|
@ -41,42 +41,3 @@ seeds:
|
||||||
min_value: 0
|
min_value: 0
|
||||||
max_value: 8
|
max_value: 8
|
||||||
strictly: False
|
strictly: False
|
||||||
- name: stg_seed__hardcoded_currency_rates
|
|
||||||
description: |
|
|
||||||
A bunch of rates between currencies, taken from our invoicing cycle in February 2024.
|
|
||||||
|
|
||||||
These are hardcoded and so will become outdated, but it's the best we have now since we don't have a live feed for exchange rates.
|
|
||||||
config:
|
|
||||||
column_types:
|
|
||||||
from_currency: varchar(3)
|
|
||||||
to_currency: varchar(3)
|
|
||||||
rate: numeric
|
|
||||||
columns:
|
|
||||||
- name: from_currency
|
|
||||||
data_type: character varying
|
|
||||||
description: The 3 character ISO 4217 code for the base currency, in Uppercase.
|
|
||||||
tests:
|
|
||||||
- not_null
|
|
||||||
- dbt_expectations.expect_column_values_to_match_regex:
|
|
||||||
regex: "^[A-Z]{3}$"
|
|
||||||
columns:
|
|
||||||
- name: to_currency
|
|
||||||
data_type: character varying
|
|
||||||
description: The 3 character ISO 4217 code for the target currency, in Uppercase.
|
|
||||||
tests:
|
|
||||||
- not_null
|
|
||||||
- dbt_expectations.expect_column_values_to_match_regex:
|
|
||||||
regex: "^[A-Z]{3}$"
|
|
||||||
- name: rate
|
|
||||||
data_type: numeric
|
|
||||||
description: |
|
|
||||||
The rate between the two currencies. You should read it as the amount of target currency you get for each unit of base currency.
|
|
||||||
|
|
||||||
For example: for the combination EUR-GBP, a rate of 0.8 means you get 0.8 GBP for 1 EUR.
|
|
||||||
|
|
||||||
Rates between same-currency pairs are always one.
|
|
||||||
tests:
|
|
||||||
- not_null
|
|
||||||
- dbt_expectations.expect_column_values_to_be_between:
|
|
||||||
min_value: 0.00000000001
|
|
||||||
max_value: 999999999999
|
|
||||||
|
|
|
||||||
|
|
@ -1,65 +0,0 @@
|
||||||
from_currency,to_currency,rate
|
|
||||||
EUR,EUR,1
|
|
||||||
USD,USD,1
|
|
||||||
GBP,GBP,1
|
|
||||||
CAD,CAD,1
|
|
||||||
AUD,AUD,1
|
|
||||||
ZAR,ZAR,1
|
|
||||||
NZD,NZD,1
|
|
||||||
PLN,PLN,1
|
|
||||||
EUR,USD,1.08286
|
|
||||||
EUR,GBP,0.85555
|
|
||||||
EUR,CAD,1.4688
|
|
||||||
EUR,AUD,1.66453
|
|
||||||
EUR,ZAR,20.7993
|
|
||||||
EUR,NZD,1.77391
|
|
||||||
EUR,PLN,4.31113
|
|
||||||
USD,EUR,0.92335
|
|
||||||
USD,GBP,0.79003
|
|
||||||
USD,CAD,1.3564
|
|
||||||
USD,AUD,1.53701
|
|
||||||
USD,ZAR,19.2073
|
|
||||||
USD,NZD,1.63816
|
|
||||||
USD,PLN,3.98085
|
|
||||||
GBP,EUR,1.16864
|
|
||||||
GBP,USD,1.26559
|
|
||||||
GBP,CAD,1.71664
|
|
||||||
GBP,AUD,1.94522
|
|
||||||
GBP,ZAR,24.3085
|
|
||||||
GBP,NZD,2.07323
|
|
||||||
GBP,PLN,5.03811
|
|
||||||
NZD,EUR,0.56352
|
|
||||||
NZD,USD,0.6103
|
|
||||||
NZD,GBP,0.48216
|
|
||||||
NZD,CAD,0.82781
|
|
||||||
NZD,AUD,0.9381
|
|
||||||
NZD,ZAR,11.7222
|
|
||||||
NZD,PLN,2.42951
|
|
||||||
CAD,EUR,0.68064
|
|
||||||
CAD,USD,0.73714
|
|
||||||
CAD,GBP,0.58237
|
|
||||||
CAD,AUD,1.133
|
|
||||||
CAD,ZAR,14.1585
|
|
||||||
CAD,NZD,1.20756
|
|
||||||
CAD,PLN,2.93446
|
|
||||||
AUD,EUR,0.60068
|
|
||||||
AUD,USD,0.65049
|
|
||||||
AUD,GBP,0.51391
|
|
||||||
AUD,CAD,0.88232
|
|
||||||
AUD,ZAR,12.4941
|
|
||||||
AUD,NZD,1.06572
|
|
||||||
AUD,PLN,2.58949
|
|
||||||
ZAR,EUR,0.04804
|
|
||||||
ZAR,USD,0.05203
|
|
||||||
ZAR,GBP,0.0411
|
|
||||||
ZAR,CAD,0.07057
|
|
||||||
ZAR,AUD,0.07997
|
|
||||||
ZAR,NZD,0.08523
|
|
||||||
ZAR,PLN,0.20712
|
|
||||||
PLN,EUR,0.23184
|
|
||||||
PLN,USD,0.25106
|
|
||||||
PLN,GBP,0.19835
|
|
||||||
PLN,CAD,0.34054
|
|
||||||
PLN,AUD,0.38588
|
|
||||||
PLN,ZAR,4.82218
|
|
||||||
PLN,NZD,0.41128
|
|
||||||
|
Loading…
Add table
Add a link
Reference in a new issue