commit wip
This commit is contained in:
parent
721f3e4e9e
commit
2c5301c158
4 changed files with 46 additions and 60 deletions
|
|
@ -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") }}
|
{{ config(materialized="table") }}
|
||||||
with
|
with
|
||||||
stg_core__user_product_bundle as (
|
stg_core__user_product_bundle as (
|
||||||
|
|
@ -18,13 +22,12 @@ select
|
||||||
pb.id_user_product_bundle,
|
pb.id_user_product_bundle,
|
||||||
pb.id_user as id_user_host,
|
pb.id_user as id_user_host,
|
||||||
pb.id_product_bundle,
|
pb.id_product_bundle,
|
||||||
ps.id_product_service as id_product,
|
ps.id_product_service as id_service,
|
||||||
'SERVICE' as product_type,
|
'PRODUCT' as service_source,
|
||||||
pb.product_bundle_name,
|
pb.product_bundle_name,
|
||||||
ps.service_business_type,
|
ps.service_business_type,
|
||||||
ps.is_default_service,
|
ps.is_default_service,
|
||||||
ps.product_service_name as product_name,
|
ps.product_service_display_name as service_name
|
||||||
ps.product_service_display_name as product_display_name
|
|
||||||
from stg_core__user_product_bundle pb
|
from stg_core__user_product_bundle pb
|
||||||
inner join int_core__user_host uh on pb.id_user = uh.id_user_host
|
inner join int_core__user_host uh on pb.id_user = uh.id_user_host
|
||||||
cross join stg_core__product_service ps
|
cross join stg_core__product_service ps
|
||||||
|
|
@ -36,15 +39,12 @@ select
|
||||||
pb.id_user_product_bundle,
|
pb.id_user_product_bundle,
|
||||||
pb.id_user as id_user_host,
|
pb.id_user as id_user_host,
|
||||||
pb.id_product_bundle,
|
pb.id_product_bundle,
|
||||||
coalesce(pb.id_protection_plan, 1) as id_product,
|
coalesce(pb.id_protection_plan, {{ default_id_protection }}) as id_service,
|
||||||
'PROTECTION' as product_type,
|
'PROTECTION' as service_source,
|
||||||
pb.product_bundle_name,
|
pb.product_bundle_name,
|
||||||
'PROTECTION' as service_business_type,
|
'PROTECTION' as service_business_type,
|
||||||
pp.is_default_service,
|
pp.is_default_service,
|
||||||
coalesce(pp.protection_name, {{ var("default_service") }}) as product_name,
|
coalesce(pp.protection_display_name, {{ var("default_service") }}) as service_name
|
||||||
coalesce(
|
|
||||||
pp.protection_display_name, {{ var("default_service") }}
|
|
||||||
) as product_display_name
|
|
||||||
from stg_core__user_product_bundle pb
|
from stg_core__user_product_bundle pb
|
||||||
inner join int_core__user_host uh on pb.id_user = uh.id_user_host
|
inner join int_core__user_host uh on pb.id_user = uh.id_user_host
|
||||||
left join
|
left join
|
||||||
|
|
|
||||||
|
|
@ -3027,8 +3027,8 @@ models:
|
||||||
- dbt_utils.unique_combination_of_columns:
|
- dbt_utils.unique_combination_of_columns:
|
||||||
combination_of_columns:
|
combination_of_columns:
|
||||||
- id_user_product_bundle
|
- id_user_product_bundle
|
||||||
- id_product
|
- id_service
|
||||||
- product_type
|
- service_source
|
||||||
|
|
||||||
columns:
|
columns:
|
||||||
- name: id_user_product_bundle
|
- name: id_user_product_bundle
|
||||||
|
|
@ -3051,22 +3051,22 @@ models:
|
||||||
description: |
|
description: |
|
||||||
The identifier of the product bundle. Can be null if it's a custom bundle.
|
The identifier of the product bundle. Can be null if it's a custom bundle.
|
||||||
|
|
||||||
- name: id_product
|
- name: id_service
|
||||||
data_type: bigint
|
data_type: bigint
|
||||||
description: |
|
description: |
|
||||||
The identifier of the product.
|
The identifier of the service.
|
||||||
data_tests:
|
data_tests:
|
||||||
- not_null
|
- not_null
|
||||||
|
|
||||||
- name: product_type
|
- name: service_source
|
||||||
data_type: string
|
data_type: string
|
||||||
description: |
|
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:
|
data_tests:
|
||||||
- not_null
|
- not_null
|
||||||
- accepted_values:
|
- accepted_values:
|
||||||
values:
|
values:
|
||||||
- "SERVICE"
|
- "PRODUCT"
|
||||||
- "PROTECTION"
|
- "PROTECTION"
|
||||||
|
|
||||||
- name: product_bundle_name
|
- name: product_bundle_name
|
||||||
|
|
@ -3097,17 +3097,10 @@ models:
|
||||||
Flag that determines if the service is a default one (True)
|
Flag that determines if the service is a default one (True)
|
||||||
or an upgraded service (False).
|
or an upgraded service (False).
|
||||||
|
|
||||||
- name: product_name
|
- name: service_name
|
||||||
data_type: string
|
data_type: string
|
||||||
description: |
|
description: |
|
||||||
The name of the product service or protection.
|
The display name of the service.
|
||||||
data_tests:
|
|
||||||
- not_null
|
|
||||||
|
|
||||||
- name: product_display_name
|
|
||||||
data_type: string
|
|
||||||
description: |
|
|
||||||
The display name of the product service or protection.
|
|
||||||
data_tests:
|
data_tests:
|
||||||
- not_null
|
- not_null
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
materialized="table",
|
materialized="table",
|
||||||
unique_key=[
|
unique_key=[
|
||||||
"date",
|
"date",
|
||||||
"id_user_host",
|
"id_deal",
|
||||||
"product_bundle_name",
|
"id_user_product_bundle",
|
||||||
"service_name",
|
"service_name",
|
||||||
"service_business_type",
|
"service_business_type",
|
||||||
],
|
],
|
||||||
|
|
@ -13,12 +13,11 @@
|
||||||
select
|
select
|
||||||
-- Unique Key --
|
-- Unique Key --
|
||||||
dd.date,
|
dd.date,
|
||||||
bs.id_user_host,
|
uh.id_deal,
|
||||||
bs.product_bundle_name,
|
bs.id_user_product_bundle,
|
||||||
bs.product_display_name as service_name,
|
bs.service_name,
|
||||||
bs.service_business_type,
|
bs.service_business_type,
|
||||||
-- Dimensions --
|
-- Dimensions --
|
||||||
coalesce(uh.id_deal, 'UNSET') as id_deal,
|
|
||||||
case when bs.is_default_service then 'NO' else 'YES' end as is_upgraded_service,
|
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(uh.new_dash_version, 'UNSET') as new_dash_version,
|
||||||
coalesce(
|
coalesce(
|
||||||
|
|
|
||||||
|
|
@ -7392,8 +7392,8 @@ models:
|
||||||
The unique key corresponds to the deepest granularity of the model,
|
The unique key corresponds to the deepest granularity of the model,
|
||||||
in this case:
|
in this case:
|
||||||
- date,
|
- date,
|
||||||
- id_user_host,
|
- id_deal,
|
||||||
- product_bundle_name,
|
- id_user_product_bundle,
|
||||||
- service_name,
|
- service_name,
|
||||||
- service_business_type
|
- service_business_type
|
||||||
|
|
||||||
|
|
@ -7401,7 +7401,7 @@ models:
|
||||||
- dbt_utils.unique_combination_of_columns:
|
- dbt_utils.unique_combination_of_columns:
|
||||||
combination_of_columns:
|
combination_of_columns:
|
||||||
- date
|
- date
|
||||||
- id_user_host
|
- id_deal
|
||||||
- id_user_product_bundle
|
- id_user_product_bundle
|
||||||
- service_name
|
- service_name
|
||||||
- service_business_type
|
- service_business_type
|
||||||
|
|
@ -7413,15 +7413,15 @@ models:
|
||||||
data_tests:
|
data_tests:
|
||||||
- not_null
|
- not_null
|
||||||
|
|
||||||
- name: id_user_host
|
- name: id_deal
|
||||||
data_type: bigint
|
data_type: string
|
||||||
description: Unique identifier of the User Host.
|
description: Unique identifier of an account.
|
||||||
data_tests:
|
data_tests:
|
||||||
- not_null
|
- not_null
|
||||||
|
|
||||||
- name: product_bundle_name
|
- name: id_user_product_bundle
|
||||||
data_type: string
|
data_type: bigint
|
||||||
description: Name of the product bundle.
|
description: Unique identifier of the User Product Bundle.
|
||||||
data_tests:
|
data_tests:
|
||||||
- not_null
|
- not_null
|
||||||
|
|
||||||
|
|
@ -7431,24 +7431,6 @@ models:
|
||||||
data_tests:
|
data_tests:
|
||||||
- not_null
|
- 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
|
- name: service_business_type
|
||||||
data_type: string
|
data_type: string
|
||||||
description: |
|
description: |
|
||||||
|
|
@ -7466,6 +7448,18 @@ models:
|
||||||
- "UNKNOWN"
|
- "UNKNOWN"
|
||||||
- "UNSET"
|
- "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
|
- name: new_dash_version
|
||||||
data_type: string
|
data_type: string
|
||||||
description: |
|
description: |
|
||||||
|
|
@ -7495,4 +7489,4 @@ models:
|
||||||
description: |
|
description: |
|
||||||
Main billing country of the host aggregated at Deal level.
|
Main billing country of the host aggregated at Deal level.
|
||||||
data_tests:
|
data_tests:
|
||||||
- not_null
|
- not_null
|
||||||
Loading…
Add table
Add a link
Reference in a new issue