From ffd8075e5e6ba60d1a3903c927105928a000895e Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Fri, 23 Feb 2024 13:59:13 +0100 Subject: [PATCH] add file and schema --- dbt_project.yml | 4 + seeds/schema.yaml | 44 +++++++++ seeds/stg_seed__currencies.csv | 167 +++++++++++++++++++++++++++++++++ 3 files changed, 215 insertions(+) create mode 100644 seeds/schema.yaml create mode 100644 seeds/stg_seed__currencies.csv diff --git a/dbt_project.yml b/dbt_project.yml index a9df12e..6a62fcb 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -40,5 +40,9 @@ models: +materialized: table +schema: reporting +seeds: + dwh_dbt: + schema: staging + vars: "dbt_date:time_zone": "Europe/London" diff --git a/seeds/schema.yaml b/seeds/schema.yaml new file mode 100644 index 0000000..6f8c2f0 --- /dev/null +++ b/seeds/schema.yaml @@ -0,0 +1,44 @@ +version: 2 + +seeds: + - name: stg_seed__currencies + description: | + A list of valid current currencies according to ISO 4217. + + The list was obtained from https://www.six-group.com/en/products-services/financial-information/data-standards.html#scrollTo=isin + config: + column_types: + iso_4217_numeric_code: varchar(3) + columns: + - name: iso_4217_code + data_type: character varying + description: The 3 character ISO 4217 code for this currency, in Uppercase. + tests: + - not_null + - dbt_expectations.expect_column_values_to_match_regex: + regex: "^[A-Z]{3}$" + - name: iso_4217_numeric_code + data_type: character varying + description: The 3 digit ISO 4217 numeric code for this currency. + tests: + - not_null + - dbt_expectations.expect_column_values_to_match_regex: + regex: "^[0-9]{3}$" + - name: decimal_positions + data_type: int + description: | + The decimal positions that lead to this currency smallest unit. + + For example: since Japanese Yen (JPY) have no cents, this value is 0. + + On the other hand, since the US Dollar (USD) is composed of cents, and each dollar equals 100 cent, this value is 2. + + To convert from normal unit (Dollar) to smallest unit (Cent), multiply by `10^decimal_positions`. + To convert from smallest unit (Cent) to normal unit (Dollar), divide by `10^decimal_positions`. + tests: + - not_null + - dbt_expectations.expect_column_values_to_be_between: + min_value: 0 + max_value: 8 + strictly: False + diff --git a/seeds/stg_seed__currencies.csv b/seeds/stg_seed__currencies.csv new file mode 100644 index 0000000..d61b921 --- /dev/null +++ b/seeds/stg_seed__currencies.csv @@ -0,0 +1,167 @@ +iso_4217_code,iso_4217_numeric_code,decimal_positions +AFN,"971",2 +EUR,"978",2 +ALL,"008",2 +DZD,"012",2 +USD,"840",2 +AOA,"973",2 +XCD,"951",2 +ARS,"032",2 +AMD,"051",2 +AWG,"533",2 +AUD,"036",2 +AZN,"944",2 +BSD,"044",2 +BHD,"048",3 +BDT,"050",2 +BBD,"052",2 +BYN,"933",2 +BZD,"084",2 +XOF,"952",0 +BMD,"060",2 +INR,"356",2 +BTN,"064",2 +BOB,"068",2 +BOV,"984",2 +BAM,"977",2 +BWP,"072",2 +NOK,"578",2 +BRL,"986",2 +BND,"096",2 +BGN,"975",2 +BIF,"108",0 +CVE,"132",2 +KHR,"116",2 +XAF,"950",0 +CAD,"124",2 +KYD,"136",2 +CLP,"152",0 +CLF,"990",4 +CNY,"156",2 +COP,"170",2 +COU,"970",2 +KMF,"174",0 +CDF,"976",2 +NZD,"554",2 +CRC,"188",2 +CUP,"192",2 +CUC,"931",2 +ANG,"532",2 +CZK,"203",2 +DKK,"208",2 +DJF,"262",0 +DOP,"214",2 +EGP,"818",2 +SVC,"222",2 +ERN,"232",2 +SZL,"748",2 +ETB,"230",2 +FKP,"238",2 +FJD,"242",2 +XPF,"953",0 +GMD,"270",2 +GEL,"981",2 +GHS,"936",2 +GIP,"292",2 +GTQ,"320",2 +GBP,"826",2 +GNF,"324",0 +GYD,"328",2 +HTG,"332",2 +HNL,"340",2 +HKD,"344",2 +HUF,"348",2 +ISK,"352",0 +IDR,"360",2 +IRR,"364",2 +IQD,"368",3 +ILS,"376",2 +JMD,"388",2 +JPY,"392",0 +JOD,"400",3 +KZT,"398",2 +KES,"404",2 +KPW,"408",2 +KRW,"410",0 +KWD,"414",3 +KGS,"417",2 +LAK,"418",2 +LBP,"422",2 +LSL,"426",2 +ZAR,"710",2 +LRD,"430",2 +LYD,"434",3 +CHF,"756",2 +MOP,"446",2 +MKD,"807",2 +MGA,"969",2 +MWK,"454",2 +MYR,"458",2 +MVR,"462",2 +MRU,"929",2 +MUR,"480",2 +MXN,"484",2 +MXV,"979",2 +MDL,"498",2 +MNT,"496",2 +MAD,"504",2 +MZN,"943",2 +MMK,"104",2 +NAD,"516",2 +NPR,"524",2 +NIO,"558",2 +NGN,"566",2 +OMR,"512",3 +PKR,"586",2 +PAB,"590",2 +PGK,"598",2 +PYG,"600",0 +PEN,"604",2 +PHP,"608",2 +PLN,"985",2 +QAR,"634",2 +RON,"946",2 +RUB,"643",2 +RWF,"646",0 +SHP,"654",2 +WST,"882",2 +STN,"930",2 +SAR,"682",2 +RSD,"941",2 +SCR,"690",2 +SLE,"925",2 +SGD,"702",2 +SBD,"090",2 +SOS,"706",2 +SSP,"728",2 +LKR,"144",2 +SDG,"938",2 +SRD,"968",2 +SEK,"752",2 +CHE,"947",2 +CHW,"948",2 +SYP,"760",2 +TWD,"901",2 +TJS,"972",2 +TZS,"834",2 +THB,"764",2 +TOP,"776",2 +TTD,"780",2 +TND,"788",3 +TRY,"949",2 +TMT,"934",2 +UGX,"800",0 +UAH,"980",2 +AED,"784",2 +USN,"997",2 +UYU,"858",2 +UYI,"940",0 +UYW,"927",4 +UZS,"860",2 +VUV,"548",0 +VES,"928",2 +VED,"926",2 +VND,"704",0 +YER,"886",2 +ZMW,"967",2 +ZWL,"932",2