Merged PR 2511: Adding stg_core__role and stg_core__user_role in staging
# Description Adds Role and UserRole in staging, in dedicated tables. Open to discussion if you want me to directly apply this at User table level instead of having them in staging as standalone tables. Otherwise, staying with this PR as is, next step would be to integrate these roles in unified_user and create a dedicated user_host table in intermediate # Checklist - [X] The edited models and dependants run properly with production data. - [X] The edited models are sufficiently documented. - [X] The edited models contain PK tests, and I've ran and passed them. - [X] I have checked for DRY opportunities with other models and docs. - [X] I've picked the right materialization for the affected models. # Other - [ ] Check if a full-refresh is required after this PR is merged. Related work items: #19513
This commit is contained in:
parent
94bdc53adf
commit
ad7d94b604
4 changed files with 50 additions and 0 deletions
|
|
@ -215,3 +215,7 @@ sources:
|
|||
identifier: VerificationSet
|
||||
- name: GuestSatisfaction
|
||||
identifier: GuestSatisfaction
|
||||
- name: UserRole
|
||||
identifier: UserRole
|
||||
- name: Role
|
||||
identifier: Role
|
||||
|
|
|
|||
|
|
@ -134,3 +134,25 @@ models:
|
|||
tests:
|
||||
- unique
|
||||
- not_null
|
||||
|
||||
- name: stg_core__role
|
||||
columns:
|
||||
- name: id_role
|
||||
tests:
|
||||
- unique
|
||||
- not_null
|
||||
- name: role_name
|
||||
tests:
|
||||
- unique
|
||||
- not_null
|
||||
|
||||
- name: stg_core__user_role
|
||||
columns:
|
||||
- name: id_role
|
||||
tests:
|
||||
- unique
|
||||
- not_null
|
||||
- name: id_user
|
||||
tests:
|
||||
- unique
|
||||
- not_null
|
||||
12
models/staging/core/stg_core__role.sql
Normal file
12
models/staging/core/stg_core__role.sql
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
with source as (
|
||||
select * from {{ source('core', 'Role') }}
|
||||
),
|
||||
stg_core__role as (
|
||||
select
|
||||
{{ adapter.quote("Id") }} as id_role,
|
||||
{{ adapter.quote("Name") }} as role_name,
|
||||
{{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_utc
|
||||
from source
|
||||
)
|
||||
select * from stg_core__role
|
||||
|
||||
12
models/staging/core/stg_core__user_role.sql
Normal file
12
models/staging/core/stg_core__user_role.sql
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
with source as (
|
||||
select * from {{ source('core', 'UserRole') }}
|
||||
),
|
||||
stg_core__user_role as (
|
||||
select
|
||||
{{ adapter.quote("UserId") }} as id_user,
|
||||
{{ adapter.quote("RoleId") }} as id_role,
|
||||
{{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_utc
|
||||
from source
|
||||
)
|
||||
select * from stg_core__user_role
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue