Merged PR 5389: Adapt Test Account flag with Claim dedicated source
# Description Applies the new dedicated source of truth of "is this account fake" based on Claims. This removes the previous logic. In terms of differences, not much because: 1. New logic applied in the backend is pretty much the same as we had with a few improvements 2. This exclusion is only applied for New Dash. I checked the number of test accounts in New Dash and these are 2, the same ones in the new logic and for the old (currently in production). So no real impact. Impact will come at the moment to start handling exclusions for KPIs, but this will done later on dedicated PRs to assess impacts properly. # 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: #27319
This commit is contained in:
parent
7f2a8a98b6
commit
9cbb748b0f
1 changed files with 13 additions and 13 deletions
|
|
@ -1,11 +1,20 @@
|
|||
{% set test_account_type_name = "('TEST')" %}
|
||||
{% set test_account_claim_type = "('TESTACCOUNT')" %}
|
||||
{% set test_account_claim_value = "('1')" %}
|
||||
|
||||
with
|
||||
stg_core__user as (select * from {{ ref("stg_core__user") }}),
|
||||
stg_core__superhog_user as (select * from {{ ref("stg_core__superhog_user") }}),
|
||||
stg_core__currency as (select * from {{ ref("stg_core__currency") }}),
|
||||
stg_core__country as (select * from {{ ref("stg_core__country") }}),
|
||||
stg_core__account_type as (select * from {{ ref("stg_core__account_type") }})
|
||||
stg_core__account_type as (select * from {{ ref("stg_core__account_type") }}),
|
||||
stg_core__claim as (select * from {{ ref("stg_core__claim") }}),
|
||||
test_accounts as (
|
||||
select distinct id_user
|
||||
from stg_core__claim
|
||||
where
|
||||
upper(claim_type) in {{ test_account_claim_type }}
|
||||
and claim_value in {{ test_account_claim_value }}
|
||||
)
|
||||
select
|
||||
u.id_user,
|
||||
u.id_account_type,
|
||||
|
|
@ -45,19 +54,10 @@ select
|
|||
su.number_of_properties,
|
||||
su.id_superhog_verified_set,
|
||||
su.id_user_verification_status,
|
||||
case
|
||||
when act.account_type_name in {{ test_account_type_name }}
|
||||
then true
|
||||
when u.email like '%@guardhog.com'
|
||||
then true
|
||||
when u.email like '%@superhog.com'
|
||||
then true
|
||||
when u.email like '%@truvi.com'
|
||||
then true
|
||||
else false
|
||||
end as is_test_account
|
||||
case when ta.id_user is not null then true else false end as is_test_account
|
||||
from stg_core__user as u
|
||||
inner join stg_core__superhog_user as su on u.id_user = su.id_superhoguser
|
||||
left join stg_core__currency cu on u.id_account_currency = cu.id_currency
|
||||
left join stg_core__country co on u.id_billing_country = co.id_country
|
||||
left join stg_core__account_type act on u.id_account_type = act.id_account_type
|
||||
left join test_accounts ta on u.id_user = ta.id_user
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue