commit wip

This commit is contained in:
Joaquin 2025-03-25 12:25:47 +01:00
parent 721f3e4e9e
commit 2c5301c158
4 changed files with 46 additions and 60 deletions

View file

@ -1,3 +1,7 @@
-- Default Protection Plan Id to use when the Id is missing in the source data.
-- This value represents "Basic Screening" protection.
{% set default_id_protection = 1 %}
{{ config(materialized="table") }}
with
stg_core__user_product_bundle as (
@ -18,13 +22,12 @@ select
pb.id_user_product_bundle,
pb.id_user as id_user_host,
pb.id_product_bundle,
ps.id_product_service as id_product,
'SERVICE' as product_type,
ps.id_product_service as id_service,
'PRODUCT' as service_source,
pb.product_bundle_name,
ps.service_business_type,
ps.is_default_service,
ps.product_service_name as product_name,
ps.product_service_display_name as product_display_name
ps.product_service_display_name as service_name
from stg_core__user_product_bundle pb
inner join int_core__user_host uh on pb.id_user = uh.id_user_host
cross join stg_core__product_service ps
@ -36,15 +39,12 @@ select
pb.id_user_product_bundle,
pb.id_user as id_user_host,
pb.id_product_bundle,
coalesce(pb.id_protection_plan, 1) as id_product,
'PROTECTION' as product_type,
coalesce(pb.id_protection_plan, {{ default_id_protection }}) as id_service,
'PROTECTION' as service_source,
pb.product_bundle_name,
'PROTECTION' as service_business_type,
pp.is_default_service,
coalesce(pp.protection_name, {{ var("default_service") }}) as product_name,
coalesce(
pp.protection_display_name, {{ var("default_service") }}
) as product_display_name
coalesce(pp.protection_display_name, {{ var("default_service") }}) as service_name
from stg_core__user_product_bundle pb
inner join int_core__user_host uh on pb.id_user = uh.id_user_host
left join

View file

@ -3027,8 +3027,8 @@ models:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- id_user_product_bundle
- id_product
- product_type
- id_service
- service_source
columns:
- name: id_user_product_bundle
@ -3051,22 +3051,22 @@ models:
description: |
The identifier of the product bundle. Can be null if it's a custom bundle.
- name: id_product
- name: id_service
data_type: bigint
description: |
The identifier of the product.
The identifier of the service.
data_tests:
- not_null
- name: product_type
- name: service_source
data_type: string
description: |
The type of the product, which can be either "service" or "protection".
The type of the service, which can be either "product" or "protection".
data_tests:
- not_null
- accepted_values:
values:
- "SERVICE"
- "PRODUCT"
- "PROTECTION"
- name: product_bundle_name
@ -3097,17 +3097,10 @@ models:
Flag that determines if the service is a default one (True)
or an upgraded service (False).
- name: product_name
- name: service_name
data_type: string
description: |
The name of the product service or protection.
data_tests:
- not_null
- name: product_display_name
data_type: string
description: |
The display name of the product service or protection.
The display name of the service.
data_tests:
- not_null

View file

@ -3,8 +3,8 @@
materialized="table",
unique_key=[
"date",
"id_user_host",
"product_bundle_name",
"id_deal",
"id_user_product_bundle",
"service_name",
"service_business_type",
],
@ -13,12 +13,11 @@
select
-- Unique Key --
dd.date,
bs.id_user_host,
bs.product_bundle_name,
bs.product_display_name as service_name,
uh.id_deal,
bs.id_user_product_bundle,
bs.service_name,
bs.service_business_type,
-- Dimensions --
coalesce(uh.id_deal, 'UNSET') as id_deal,
case when bs.is_default_service then 'NO' else 'YES' end as is_upgraded_service,
coalesce(uh.new_dash_version, 'UNSET') as new_dash_version,
coalesce(

View file

@ -7392,8 +7392,8 @@ models:
The unique key corresponds to the deepest granularity of the model,
in this case:
- date,
- id_user_host,
- product_bundle_name,
- id_deal,
- id_user_product_bundle,
- service_name,
- service_business_type
@ -7401,7 +7401,7 @@ models:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- date
- id_user_host
- id_deal
- id_user_product_bundle
- service_name
- service_business_type
@ -7413,15 +7413,15 @@ models:
data_tests:
- not_null
- name: id_user_host
data_type: bigint
description: Unique identifier of the User Host.
- name: id_deal
data_type: string
description: Unique identifier of an account.
data_tests:
- not_null
- name: product_bundle_name
data_type: string
description: Name of the product bundle.
- name: id_user_product_bundle
data_type: bigint
description: Unique identifier of the User Product Bundle.
data_tests:
- not_null
@ -7431,24 +7431,6 @@ models:
data_tests:
- not_null
- name: id_deal
data_type: string
description: Unique identifier of an account.
data_tests:
- not_null
- name: is_upgraded_service
data_type: string
description: |
Whether the service is an upgraded version of the
default. In other words, if it's not Basic Screening.
data_tests:
- not_null
- accepted_values:
values:
- "YES"
- "NO"
- name: service_business_type
data_type: string
description: |
@ -7466,6 +7448,18 @@ models:
- "UNKNOWN"
- "UNSET"
- name: is_upgraded_service
data_type: string
description: |
Whether the service is an upgraded version of the
default. In other words, if it's not Basic Screening.
data_tests:
- not_null
- accepted_values:
values:
- "YES"
- "NO"
- name: new_dash_version
data_type: string
description: |
@ -7495,4 +7489,4 @@ models:
description: |
Main billing country of the host aggregated at Deal level.
data_tests:
- not_null
- not_null