adapt stg_core__user

This commit is contained in:
Pablo Martin 2024-02-15 16:16:24 +01:00
parent ab5902ff1f
commit 599d7085cf

View file

@ -1,23 +1,39 @@
with raw_user as (select * from {{ source("core", "user") }})
select
cast("Id" as uuid) as id_user,
code as user_code,
firstname as first_name,
lastname as last_name,
email as email,
title as title,
dealid as id_deal,
deleted as is_deleted,
joindate as join_date_utc,
username as user_name,
codeprefix as code_prefix,
billingtown as billing_town,
companyname as company_name,
emailconfirmed as is_email_confirmed,
lockoutenabled as is_lockout_enabled,
billingpostcode as billing_postcode,
billingcountryid as id_billing_country,
twofactorenabled as is_twofactor_enabled,
accessfailedcount as access_failed_count,
lockoutenddateutc as lockout_end_date_utc
from raw_user
with
raw_user as (select * from {{ source("core", "user") }}),
stg_core__user as (
select
{{ adapter.quote("Id") }} as id_user,
{{ adapter.quote("Code") }} as user_code,
{{ adapter.quote("Email") }} as email,
{{ adapter.quote("Title") }} as title,
{{ adapter.quote("DealId") }} as id_deal,
{{ adapter.quote("Deleted") }} as is_deleted,
{{ adapter.quote("JoinDate") }} as join_date_utc,
{{ adapter.quote("LastName") }} as last_name,
{{ adapter.quote("UserName") }} as user_name,
{{ adapter.quote("FirstName") }} as first_name,
{{ adapter.quote("CodePrefix") }} as code_prefix,
{{ adapter.quote("BillingTown") }} as billing_town,
{{ adapter.quote("CompanyName") }} as company_name,
{{ adapter.quote("DateOfBirth") }} 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,
{{ adapter.quote("BillingAddressLine1") }} as billing_address_line_1,
{{ adapter.quote("BillingAddressLine2") }} as billing_address_line_2,
{{ adapter.quote("PhoneNumberConfirmed") }} as is_phone_number_confirmed,
{{ adapter.quote("_airbyte_extracted_at") }} as dwh_loaded_at_date
from raw_user
)
select *
from stg_core__user