From 599d7085cfe9b23a852778bf571478b0533d3ec0 Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Thu, 15 Feb 2024 16:16:24 +0100 Subject: [PATCH] adapt stg_core__user --- models/staging/core/stg_core__user.sql | 62 ++++++++++++++++---------- 1 file changed, 39 insertions(+), 23 deletions(-) diff --git a/models/staging/core/stg_core__user.sql b/models/staging/core/stg_core__user.sql index 92db421..8c50ef7 100644 --- a/models/staging/core/stg_core__user.sql +++ b/models/staging/core/stg_core__user.sql @@ -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