Merged PR 3625: Excludes new dash users without id deal

# Description

This PR has 2 commits:
- The first one handles the removal from the computation any user that has not an id deal properly set. I just created a boolean field in int_core__user_host that identifies if the host has no id_deal. Then apply the new condition in the 2 main usages of New Dash info.
- The second one cleans New Dash KPIs. Since we do not have anymore users without deals, it means that the identification of the host/account is going to be exactly the same if done by id_user_host or id_deal. I hated having id_user_host in KPIs so I've removed it :)

Lastly, this should speed up massively the execution. Not because there's improvements on the code but rather the reduction of data.

# 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: #20809
This commit is contained in:
Oriol Roqué Paniagua 2024-11-21 16:30:47 +00:00
parent 2e7c85d11b
commit b0bed479c7
9 changed files with 16 additions and 39 deletions

View file

@ -49,6 +49,7 @@ select
uu.joined_date_utc,
uu.created_date_utc,
uu.updated_date_utc,
case when uu.id_deal is null then true else false end as is_missing_id_deal,
case
when ndu.id_user_host is not null then true else false
end as is_user_in_new_dash,

View file

@ -44,7 +44,7 @@ from stg_core__user_product_bundle upb
/*
There are many not migrated users that have product bundles.
Since users are not migrated, these bundles cannot be active.
In order to avoid potential upstream problems, it is enforced
In order to avoid potential downstream problems, it is enforced
that product bundles need to be from users that have been
already migrated.
*/
@ -52,4 +52,5 @@ inner join
int_core__user_host uh
on upb.id_user = uh.id_user_host
and uh.is_user_in_new_dash = true
and uh.is_missing_id_deal = false
left join stg_core__protection_plan pp on upb.id_protection_plan = pp.id_protection_plan

View file

@ -1850,6 +1850,11 @@ models:
description: |
Date of the last time the information of the Host was updated
in our systems.
- name: is_missing_id_deal
data_type: boolean
description: |
Flag to identify if a user is missing the id_deal (true) or
not (false).
- name: is_user_in_new_dash
data_type: boolean
description: |