Merged PR 3756: First version of verification request feature flag

# Description

Brings VerificationRequestFeatureFlag to staging. Needs further modelling to clean data for A/B test tracking purposes, but this will be done in intermediate.

# 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: #25145
This commit is contained in:
Oriol Roqué Paniagua 2024-12-03 16:01:23 +00:00
parent 62e1b6ea3b
commit e8f7278032
3 changed files with 112 additions and 0 deletions

View file

@ -261,3 +261,5 @@ sources:
identifier: ProductProtectionPlanBillingItem
- name: ProductServiceBillingItem
identifier: ProductServiceBillingItem
- name: VerificationRequestFeatureFlag
identifier: VerificationRequestFeatureFlag

View file

@ -1281,3 +1281,80 @@ models:
data_type: timestamp
description: |
Timestamp of when this record was extracted into DWH.
- name: stg_core__verification_request_feature_flag
description: |
Provides the Feature Flag and the variation a given Verification Request is in.
Mostly used for A/B test tracking purposes on the scope of the Guest Journey.
columns:
- name: id_verification_request_feature_flag
data_type: integer
description: |
Identifier of the Verification Request Feature Flag. Acts as the primary key for this table.
tests:
- unique
- not_null
- name: id_verification_request
data_type: integer
description: |
Identifier of the Verification Request. Acts as foreign key to the Verification Request table.
It can be duplicated across different Feature Flags - meaning the same verification request
can be part of none, one, or several A/B tests.
tests:
- not_null
- name: feature_flag_name
data_type: string
description: |
Name of the Feature Flag, or the Guest Journey A/B test. Cannot be null.
tests:
- not_null
- name: feature_flag_variation
data_type: string
description: |
Identifier of the variation a given Verification Request is in, within a
given Feature Flag, or Guest Journey A/B test. It can be null.
- name: is_feature_flag_enabled
data_type: boolean
description: |
Identifies whether the feature flag was enabled or disabled. In other words,
if the A/B test was active or not. In these cases, the feature flag variation
of the Guest Journeys would receive the default variation value (the control
group, generally speaking).
- name: created_at_utc
data_type: timestamp
description: |
Timestamp of when this Verification Request Feature Flag record was created.
tests:
- not_null
- name: created_date_utc
data_type: date
description: |
Date of when this Verification Request Feature Flag record was created.
tests:
- not_null
- name: updated_at_utc
data_type: timestamp
description: |
Timestamp of when this Verification Request Feature Flag record was last updated.
tests:
- not_null
- name: updated_date_utc
data_type: date
description: |
Date of when this Verification Request Feature Flag record was last updated.
tests:
- not_null
- name: dwh_extracted_at_utc
data_type: timestamp
description: |
Timestamp of when this Verification Request Feature Flag record was extracted into DWH.

View file

@ -0,0 +1,33 @@
{{
config(
materialized="incremental",
unique_key="id_verification_request_feature_flag",
)
}}
with
raw_verification_request_feature_flag as (
select * from {{ source("core", "VerificationRequestFeatureFlag") }}
),
stg_core__verification_request_feature_flag as (
select
{{ adapter.quote("Id") }} as id_verification_request_feature_flag,
{{ adapter.quote("VerificationRequestId") }} as id_verification_request,
{{ adapter.quote("Name") }} as feature_flag_name,
{{ adapter.quote("State") }} as feature_flag_variation,
{{ adapter.quote("IsEnabled") }} as is_feature_flag_enabled,
{{ adapter.quote("CreatedDate") }} as created_at_utc,
cast({{ adapter.quote("CreatedDate") }} as date) as created_date_utc,
{{ adapter.quote("UpdatedDate") }} as updated_at_utc,
cast({{ adapter.quote("UpdatedDate") }} as date) as updated_date_utc,
{{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_utc
from raw_verification_request_feature_flag
)
select *
from stg_core__verification_request_feature_flag
{% if is_incremental() %}
where
updated_at_utc
>= ((select max(updated_at_utc) from {{ this }}) - interval '7 days')
{% endif %}