first table reading from sync_core
This commit is contained in:
parent
727431b7b2
commit
8341125c78
5 changed files with 52 additions and 0 deletions
4
.vscode/settings.json
vendored
Normal file
4
.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"sql-formatter.uppercase": true,
|
||||||
|
"dbt.queryLimit": 500
|
||||||
|
}
|
||||||
|
|
@ -35,3 +35,6 @@ models:
|
||||||
# Config indicated by + and applies to all files under models/example/
|
# Config indicated by + and applies to all files under models/example/
|
||||||
example:
|
example:
|
||||||
+materialized: view
|
+materialized: view
|
||||||
|
staging:
|
||||||
|
+materialized: table
|
||||||
|
+schema: staging
|
||||||
|
|
|
||||||
14
macros/generate_schema_name.sql
Normal file
14
macros/generate_schema_name.sql
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
{% macro generate_schema_name(custom_schema_name, node) -%}
|
||||||
|
|
||||||
|
{%- set default_schema = target.schema -%}
|
||||||
|
{%- if custom_schema_name is none -%}
|
||||||
|
|
||||||
|
{{ default_schema }}
|
||||||
|
|
||||||
|
{%- else -%}
|
||||||
|
|
||||||
|
{{ custom_schema_name | trim }}
|
||||||
|
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
|
{%- endmacro %}
|
||||||
8
models/sources.yml
Normal file
8
models/sources.yml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
version: 2
|
||||||
|
|
||||||
|
sources:
|
||||||
|
- name: core
|
||||||
|
schema: sync_core
|
||||||
|
tables:
|
||||||
|
- name: user
|
||||||
|
identifier: User
|
||||||
23
models/staging/stg_core_user.sql
Normal file
23
models/staging/stg_core_user.sql
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
with raw_user as (select * from {{ source("core", "user") }})
|
||||||
|
select
|
||||||
|
"Id" as id_user,
|
||||||
|
code as user_code,
|
||||||
|
"Name" as name,
|
||||||
|
email as email,
|
||||||
|
title as title,
|
||||||
|
dealid as id_deal,
|
||||||
|
deleted as is_deleted,
|
||||||
|
joindate as join_date_utc,
|
||||||
|
username as username,
|
||||||
|
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,
|
||||||
|
billingcountryname as billing_country_name
|
||||||
|
from raw_user
|
||||||
Loading…
Add table
Add a link
Reference in a new issue