diff --git a/models/intermediate/core/int_core__unified_user.sql b/models/intermediate/core/int_core__unified_user.sql index b117d32..36616a7 100644 --- a/models/intermediate/core/int_core__unified_user.sql +++ b/models/intermediate/core/int_core__unified_user.sql @@ -1,8 +1,12 @@ with stg_core__user as (select * from {{ ref("stg_core__user") }}), - stg_core__superhog_user as (select * from {{ ref("stg_core__superhog_user") }}) + stg_core__superhog_user as (select * from {{ ref("stg_core__superhog_user") }}), + stg_core__currency as (select * from {{ ref("stg_core__currency") }}) select id_user, + id_account_type, + id_billing_country, + c.iso4217_code as account_currency_iso4217, user_code, first_name, last_name, @@ -38,3 +42,4 @@ select id_user_verification_status from stg_core__user as u inner join stg_core__superhog_user as su on u.id_user = su.id_superhoguser +left join stg_core__currency c on u.id_account_currency = c.id_currency diff --git a/models/staging/core/_core_sources.yml b/models/staging/core/_core_sources.yml index cf19d2c..f680cad 100644 --- a/models/staging/core/_core_sources.yml +++ b/models/staging/core/_core_sources.yml @@ -199,4 +199,6 @@ sources: identifier: PricePlanToUser - name: PricePlanChargedByType identifier: PricePlanChargedByType + - name: Currency + identifier: Currency diff --git a/models/staging/core/stg_core__currency.sql b/models/staging/core/stg_core__currency.sql new file mode 100644 index 0000000..102a309 --- /dev/null +++ b/models/staging/core/stg_core__currency.sql @@ -0,0 +1,14 @@ +with + raw_currency as (select * from {{ source("core", "Currency") }}), + stg_core__currency as ( + select + {{ adapter.quote("Id") }} as id_currency, + {{ adapter.quote("Name") }} as currency_name, + {{ adapter.quote("IsoCode") }} as iso4217_code, + {{ adapter.quote("DisplayOrder") }} as display_order, + {{ adapter.quote("_airbyte_extracted_at") }} as dwh_extract_at_utc + + from raw_currency + ) +select * +from stg_core__currency diff --git a/models/staging/core/stg_core__user.sql b/models/staging/core/stg_core__user.sql index c70a553..9e72d2d 100644 --- a/models/staging/core/stg_core__user.sql +++ b/models/staging/core/stg_core__user.sql @@ -5,6 +5,10 @@ with stg_core__user as ( select {{ adapter.quote("Id") }} as id_user, + {{ adapter.quote("AccountTypeId") }} as id_account_type, + {{ adapter.quote("CreatedUserId") }} as id_created_user, + {{ adapter.quote("BillingCountryId") }} as id_billing_country, + {{ adapter.quote("AccountCurrencyId") }} as id_account_currency, {{ adapter.quote("Code") }} as user_code, {{ adapter.quote("Email") }} as email, {{ adapter.quote("Title") }} as title, @@ -21,13 +25,10 @@ with cast({{ adapter.quote("DateOfBirth") }} as date) as date_of_birth, {{ adapter.quote("PhoneNumber") }} as phone_number, {{ adapter.quote("PasswordHash") }} as password_hash, - {{ adapter.quote("AccountTypeId") }} as id_account_type, - {{ adapter.quote("CreatedUserId") }} as id_created_user, {{ adapter.quote("SecurityStamp") }} as security_stamp, {{ adapter.quote("EmailConfirmed") }} as is_email_confirmed, {{ adapter.quote("LockoutEnabled") }} as is_lockout_enabled, {{ adapter.quote("BillingPostcode") }} as billing_postcode, - {{ adapter.quote("BillingCountryId") }} as id_billing_country, {{ adapter.quote("TwoFactorEnabled") }} as is_twofactor_enabled, {{ adapter.quote("AccessFailedCount") }} as access_failed_count, {{ adapter.quote("LockoutEndDateUtc") }} as lockout_end_date_utc,