From 33d4f18165e6bee24b3f90a94b023e3b29bc8124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oriol=20Roqu=C3=A9=20Paniagua?= Date: Mon, 13 Jan 2025 11:27:29 +0000 Subject: [PATCH] Merged PR 4034: BUGFIX: Ensure id_role are lower case # Description Ensures `id_role` are lower case. This should avoid issues downstream in dbt tests. # 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. - [ ] 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. Related work items: #26110 --- models/staging/core/stg_core__role.sql | 23 ++++++++++----------- models/staging/core/stg_core__user_role.sql | 23 ++++++++++----------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/models/staging/core/stg_core__role.sql b/models/staging/core/stg_core__role.sql index 3e12046..4879a3c 100644 --- a/models/staging/core/stg_core__role.sql +++ b/models/staging/core/stg_core__role.sql @@ -1,12 +1,11 @@ -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 - \ No newline at end of file +with + source as (select * from {{ source("core", "Role") }}), + stg_core__role as ( + select + lower({{ 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 diff --git a/models/staging/core/stg_core__user_role.sql b/models/staging/core/stg_core__user_role.sql index 0f8fbfd..4c0c143 100644 --- a/models/staging/core/stg_core__user_role.sql +++ b/models/staging/core/stg_core__user_role.sql @@ -1,12 +1,11 @@ -with source as ( - select * from {{ source('core', 'UserRole') }} -), -stg_core__user_role as ( - select - lower({{ 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 - \ No newline at end of file +with + source as (select * from {{ source("core", "UserRole") }}), + stg_core__user_role as ( + select + lower({{ adapter.quote("UserId") }}) as id_user, + lower({{ adapter.quote("RoleId") }}) as id_role, + {{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_utc + from source + ) +select * +from stg_core__user_role