fix schemas in intermediate

This commit is contained in:
Pablo Martin 2024-09-12 15:38:50 +02:00
parent aabb45dbd5
commit 05d5cc6d10
4 changed files with 327 additions and 387 deletions

View file

@ -140,18 +140,18 @@ models:
and computes any necessary weighted metric across different sources.
Each metric has a date, dimension and dimension value that defines
the primary key of this model.
Finally, it displays any metric on the current date, the previous year
date and it computes the relative increment by using the macro:
- calculate_safe_relative_increment
tests:
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- date
- dimension
- dimension_value
columns:
- name: date
data_type: date
@ -164,11 +164,11 @@ models:
description: The dimension or granularity of the metrics.
tests:
- accepted_values:
values:
values:
- global
- by_number_of_listings
- by_billing_country
- name: dimension_value
data_type: string
description: The value or segment available for the selected dimension.
@ -197,7 +197,7 @@ models:
- not_null
- name: month
data_type: int
data_type: int
description: Month number of the given date.
tests:
- not_null
@ -249,7 +249,7 @@ models:
combination_of_columns:
- date
- id_deal
columns:
- name: year
data_type: int
@ -258,7 +258,7 @@ models:
- not_null
- name: month
data_type: int
data_type: int
description: Month number of the given date.
tests:
- not_null
@ -324,14 +324,14 @@ models:
a set of metric, value, previous_year_value and relative_increment at a given date. It uses Jinja
code to avoid code replication.
tests:
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- date
- metric
- dimension
- dimension_value
columns:
- name: year
data_type: int
@ -340,7 +340,7 @@ models:
- not_null
- name: month
data_type: int
data_type: int
description: month number of the given date.
tests:
- not_null
@ -386,11 +386,11 @@ models:
description: The dimension or granularity of the metrics.
tests:
- accepted_values:
values:
values:
- global
- by_number_of_listings
- by_billing_country
- name: dimension_value
data_type: string
description: The value or segment available for the selected dimension.
@ -420,35 +420,34 @@ models:
data_type: text
description: allows for grouping and formatting for displaying purposes.
tests:
- accepted_values:
values: ['integer', 'percentage', 'currency_gbp']
- accepted_values:
values: ["integer", "percentage", "currency_gbp"]
- name: value
data_type: numeric
description: |
data_type: numeric
description: |
numeric value (integer or decimal) that corresponds to the MTD computation of the metric
at a given date.
- name: previous_year_value
data_type: numeric
description: |
data_type: numeric
description: |
numeric value (integer or decimal) that corresponds to the MTD computation of the metric
on the previous year at a given date.
- name: relative_increment
data_type: numeric
description: |
data_type: numeric
description: |
numeric value that corresponds to the relative increment between value and previous year value,
following the computation: value / previous_year_value - 1.
- name: relative_increment_with_sign_format
data_type: numeric
description: |
data_type: numeric
description: |
relative_increment value multiplied by -1 in case this metric's growth doesn't have a
positive impact for Superhog, otherwise is equal to relative_increment.
This value is specially created for formatting in PBI
- name: int_monthly_aggregated_metrics_history_by_deal
description: |
This model aggregates the monthly historic information regarding the different metrics computed
@ -463,9 +462,9 @@ models:
the int_mtd_aggregated metrics because 1) the mtd version contains more computing dates
than the by deal version, the latest being a subset of the first, and 2) the deal based model
enforces that a booking/guest journey/listing/etc has a host with a deal assigned, which is
not necessarily the case.
not necessarily the case.
tests:
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- date
@ -480,7 +479,7 @@ models:
- name: id_deal
data_type: character varying
description: Id of the deal associated to the host.
description: Id of the deal associated to the host.
tests:
- not_null
@ -496,7 +495,7 @@ models:
description: |
ISO 3166-1 alpha-3 main country code in which the Deal is billed.
In some cases it's null.
- name: int_dates_mtd_by_dimension
description: |
This model provides Month-To-Date (MTD) necessary dates, dimension and dimension_values
@ -504,7 +503,7 @@ models:
It provides the basic "empty" structure from which metrics will be built upon. This is, on
top of the Date that characterises int_dates_mtd, including the dimensions and their
respective values that should appear in any mtd metric model.
Example:
- For the "global" dimension, we will only have the "global" dimension value.
- For the "by_number_of_listing" dimension, we will have different values
@ -513,7 +512,7 @@ models:
... and so on and forth for any available dimension. These combinations should appear
for each date of the MTD models.
tests:
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- date
@ -528,7 +527,7 @@ models:
- not_null
- name: month
data_type: int
data_type: int
description: Month number of the given date.
tests:
- not_null
@ -565,7 +564,7 @@ models:
data_type: date
description: |
Main date for the computation, metrics include monthly information
until this date.
until this date.
tests:
- not_null
@ -574,13 +573,13 @@ models:
description: The dimension or granularity of the metrics.
tests:
- accepted_values:
values:
values:
- global
- by_number_of_listings
- by_billing_country
- name: dimension_value
data_type: string
description: The value or segment available for the selected dimension.
tests:
- not_null
- not_null