Merged PR 2689: KPIs by Billing Country
# Description Adds Billing Country dimension in KPIs, but does not expose them to reporting yet. Silly thing, based on the macros I built, I cannot make incremental changes unless changing all models. This will need to be adapted, happy to hear your thoughts on how we do it. Additionally, I have lack of performance of the model `mtd_guest_payments_metrics`. It takes around 5 min to execute, but technically the end-to-end runs in one shoot without breaking. It's a complex PR because it changes many files, but you will see that: * It mostly changes the join conditions for the dimensions or the schema tests, * I tried to be very careful and add things step-by-step in the commits. Goal is NOT to complete the PR yet until we see how we can improve performance. I can say though that data end-to-end looks ok to me, but would benefit from checking with production data for the new dimension Update 30th Aug * Added a new commit that includes `id_user_host` in `int_core__verification_payments`. Happy to discuss if it makes sense or not. But it changes the execution from ~600 sec to ~6 sec because it avoids a massive repeated join with `verification_requests`. # 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. - [ ] I've picked the right materialization for the affected models. **To check because of performance issues** # Other - [ ] Check if a full-refresh is required after this PR is merged. Related work items: #19082
This commit is contained in:
parent
940896824f
commit
556a52e991
12 changed files with 95 additions and 6 deletions
|
|
@ -7,6 +7,9 @@ with
|
|||
int_core__mtd_accommodation_segmentation as (
|
||||
select * from {{ ref("int_core__mtd_accommodation_segmentation") }}
|
||||
),
|
||||
int_core__user_host as (
|
||||
select * from {{ ref("int_core__user_host") }}
|
||||
),
|
||||
int_dates_mtd as (select * from {{ ref("int_dates_mtd") }})
|
||||
|
||||
{% for dimension in dimensions %}
|
||||
|
|
@ -25,6 +28,10 @@ with
|
|||
{% if dimension.dimension == "'by_number_of_listings'" %}
|
||||
inner join int_core__mtd_accommodation_segmentation a
|
||||
on d.date = a.date
|
||||
{% elif dimension.dimension == "'by_billing_country'" %}
|
||||
inner join int_core__user_host h
|
||||
on d.date >= h.created_date_utc
|
||||
and h.billing_country_iso_3 is not null
|
||||
{% endif %}
|
||||
{% if not loop.last %}
|
||||
union all
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@ models:
|
|||
values:
|
||||
- global
|
||||
- by_number_of_listings
|
||||
- by_billing_country
|
||||
|
||||
- name: dimension_value
|
||||
data_type: string
|
||||
|
|
@ -375,6 +376,7 @@ models:
|
|||
values:
|
||||
- global
|
||||
- by_number_of_listings
|
||||
- by_billing_country
|
||||
|
||||
- name: dimension_value
|
||||
data_type: string
|
||||
|
|
@ -549,6 +551,7 @@ models:
|
|||
values:
|
||||
- global
|
||||
- by_number_of_listings
|
||||
- by_billing_country
|
||||
|
||||
- name: dimension_value
|
||||
data_type: string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue