Merged PR 3823: Apim User staging models
# Description Apim User staging models It includes both the model for users data (most of it contained in a json document) as well as user type for each API platform # 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. - [ ] I've picked the right materialization for the affected models. # Other - [ ] Check if a full-refresh is required after this PR is merged. Apim User staging models Related work items: #25404
This commit is contained in:
commit
af7a194840
4 changed files with 127 additions and 0 deletions
|
|
@ -263,3 +263,7 @@ sources:
|
||||||
identifier: ProductServiceBillingItem
|
identifier: ProductServiceBillingItem
|
||||||
- name: VerificationRequestFeatureFlag
|
- name: VerificationRequestFeatureFlag
|
||||||
identifier: VerificationRequestFeatureFlag
|
identifier: VerificationRequestFeatureFlag
|
||||||
|
- name: ApimUser
|
||||||
|
identifier: ApimUser
|
||||||
|
- name: ApimUserType
|
||||||
|
identifier: ApimUserType
|
||||||
|
|
|
||||||
|
|
@ -1349,3 +1349,97 @@ models:
|
||||||
data_type: timestamp
|
data_type: timestamp
|
||||||
description: |
|
description: |
|
||||||
Timestamp of when this Verification Request Feature Flag record was extracted into DWH.
|
Timestamp of when this Verification Request Feature Flag record was extracted into DWH.
|
||||||
|
|
||||||
|
- name: stg_core__apim_user
|
||||||
|
description: |
|
||||||
|
"Contains information about API users.
|
||||||
|
It includes all users from all different API systems so the data
|
||||||
|
contained in the json document differs between them."
|
||||||
|
|
||||||
|
tests:
|
||||||
|
- dbt_utils.unique_combination_of_columns:
|
||||||
|
combination_of_columns:
|
||||||
|
- id_apim_user
|
||||||
|
- id_apim_user_type
|
||||||
|
columns:
|
||||||
|
- name: id_apim_user
|
||||||
|
data_type: character varying
|
||||||
|
description: |
|
||||||
|
Identifier of the User. Acts as part of the composite primary
|
||||||
|
key for this table.
|
||||||
|
Not necessarily unique because the same user can exist in more than
|
||||||
|
one API system.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: id_apim_user_type
|
||||||
|
data_type: bigint
|
||||||
|
description: |
|
||||||
|
"id of the user type, works as a foreign key to the
|
||||||
|
apim_user_type table"
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: json_document_user_data
|
||||||
|
data_type: character varying
|
||||||
|
description: |
|
||||||
|
"The json document that contains the user information"
|
||||||
|
|
||||||
|
- name: created_at_utc
|
||||||
|
data_type: timestamp
|
||||||
|
description: |
|
||||||
|
Timestamp of when this user was created.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: created_date_utc
|
||||||
|
data_type: date
|
||||||
|
description: |
|
||||||
|
Date of when this user was created.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: updated_at_utc
|
||||||
|
data_type: timestamp
|
||||||
|
description: |
|
||||||
|
Timestamp of when this user was last updated.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: updated_date_utc
|
||||||
|
data_type: date
|
||||||
|
description: |
|
||||||
|
Date of when this user was last updated.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: dwh_extracted_at_utc
|
||||||
|
data_type: timestamp
|
||||||
|
description: |
|
||||||
|
Timestamp of when this record was extracted into DWH.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: stg_core__apim_user_type
|
||||||
|
description: ""
|
||||||
|
columns:
|
||||||
|
- name: id_apim_user_type
|
||||||
|
data_type: bigint
|
||||||
|
description: |
|
||||||
|
Unique identifier of the type of user. Acts as the primary key for this table.
|
||||||
|
tests:
|
||||||
|
- unique
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: user_type_name
|
||||||
|
data_type: character varying
|
||||||
|
description: "Name of the user type"
|
||||||
|
tests:
|
||||||
|
- unique
|
||||||
|
|
||||||
|
- name: dwh_extracted_at_utc
|
||||||
|
data_type: timestamp with time zone
|
||||||
|
description: |
|
||||||
|
Timestamp of when this record was extracted into DWH.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
|
||||||
17
models/staging/core/stg_core__apim_user.sql
Normal file
17
models/staging/core/stg_core__apim_user.sql
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
with
|
||||||
|
raw_apim_user as (select * from {{ source("core", "ApimUser") }}),
|
||||||
|
stg_core__apim_user as (
|
||||||
|
select
|
||||||
|
{{ adapter.quote("UserId") }} as id_apim_user,
|
||||||
|
{{ adapter.quote("ApimUserTypeId") }} as id_apim_user_type,
|
||||||
|
{{ adapter.quote("Json") }} as json_document_user_data,
|
||||||
|
{{ adapter.quote("CreatedDate") }} as created_at_utc,
|
||||||
|
cast({{ adapter.quote("CreatedDate") }} as date) as created_date_utc,
|
||||||
|
{{ adapter.quote("UpdatedDate") }} as updated_at_utc,
|
||||||
|
cast({{ adapter.quote("UpdatedDate") }} as date) as updated_date_utc,
|
||||||
|
{{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_utc
|
||||||
|
|
||||||
|
from raw_apim_user
|
||||||
|
)
|
||||||
|
select *
|
||||||
|
from stg_core__apim_user
|
||||||
12
models/staging/core/stg_core__apim_user_type.sql
Normal file
12
models/staging/core/stg_core__apim_user_type.sql
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
with
|
||||||
|
raw_apim_user_type as (select * from {{ source("core", "ApimUserType") }}),
|
||||||
|
stg_core__apim_user_type as (
|
||||||
|
select
|
||||||
|
{{ adapter.quote("Id") }} as id_apim_user_type,
|
||||||
|
{{ adapter.quote("Name") }} as user_type_name,
|
||||||
|
{{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_utc
|
||||||
|
|
||||||
|
from raw_apim_user_type
|
||||||
|
)
|
||||||
|
select *
|
||||||
|
from stg_core__apim_user_type
|
||||||
Loading…
Add table
Add a link
Reference in a new issue