Apim User staging models

This commit is contained in:
Joaquin Ossa 2024-12-11 12:05:01 +01:00
parent ca0fa8b62d
commit 0c9c284e3c
4 changed files with 126 additions and 0 deletions

View file

@ -263,3 +263,7 @@ sources:
identifier: ProductServiceBillingItem
- name: VerificationRequestFeatureFlag
identifier: VerificationRequestFeatureFlag
- name: ApimUser
identifier: ApimUser
- name: ApimUserType
identifier: ApimUserType

View file

@ -1349,3 +1349,96 @@ models:
data_type: timestamp
description: |
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 the 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

View 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

View 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