Merged PR 3087: Adding int_core__product_service_to_price
# Description Adds int_core__product_service_to_price. This model is the equivalent of staging but just adding currency code, product service name and a few boolean fields to identify if the product service to price is currently active and if it's the default price or not. Currently it's a view since it has 16 records, likely it can be transformed into a table in the future. The idea will be to create a similar table for protection_plan. # 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. - [NA] I've picked the right materialization for the affected models. -> We will see in the future if needs to be adapted # Other - [ ] Check if a full-refresh is required after this PR is merged. Related work items: #20809
This commit is contained in:
parent
9dc1b4b99f
commit
bad27ecbc3
2 changed files with 151 additions and 0 deletions
|
|
@ -0,0 +1,28 @@
|
||||||
|
with
|
||||||
|
stg_core__product_service_to_price as (
|
||||||
|
select * from {{ ref("stg_core__product_service_to_price") }}
|
||||||
|
),
|
||||||
|
stg_core__product_service as (select * from {{ ref("stg_core__product_service") }}),
|
||||||
|
stg_core__currency as (select * from {{ ref("stg_core__currency") }})
|
||||||
|
select
|
||||||
|
pstp.id_product_service_to_price,
|
||||||
|
pstp.id_product_service,
|
||||||
|
pstp.payment_type,
|
||||||
|
pstp.price_base_unit,
|
||||||
|
pstp.invoicing_trigger,
|
||||||
|
c.iso4217_code as currency_code,
|
||||||
|
pstp.amount_local_curr,
|
||||||
|
pstp.product_service_price_name,
|
||||||
|
ps.product_service_name,
|
||||||
|
pstp.starts_at_utc,
|
||||||
|
pstp.ends_at_utc,
|
||||||
|
pstp.has_no_end_date,
|
||||||
|
pstp.created_at_utc,
|
||||||
|
pstp.created_date_utc,
|
||||||
|
pstp.updated_at_utc,
|
||||||
|
pstp.updated_date_utc,
|
||||||
|
pstp.dwh_extracted_at_utc
|
||||||
|
from stg_core__product_service_to_price pstp
|
||||||
|
left join
|
||||||
|
stg_core__product_service ps on pstp.id_product_service = ps.id_product_service
|
||||||
|
left join stg_core__currency c on pstp.id_currency = c.id_currency
|
||||||
|
|
@ -3495,3 +3495,126 @@ models:
|
||||||
The CamelCase name of the product service.
|
The CamelCase name of the product service.
|
||||||
tests:
|
tests:
|
||||||
- not_null
|
- not_null
|
||||||
|
|
||||||
|
- name: int_core__product_service_to_price
|
||||||
|
description: |
|
||||||
|
This model provides the information related to the prices of the different
|
||||||
|
product services in the scope of New Pricing. Each product service can have
|
||||||
|
prices in different currencies. Each price is storified and applies in the range
|
||||||
|
of starts to end. If the end date is null, then the price is currently active.
|
||||||
|
There is no possibility to allow custom pricing at user level.
|
||||||
|
|
||||||
|
tests:
|
||||||
|
- dbt_expectations.expect_column_pair_values_A_to_be_greater_than_B:
|
||||||
|
column_A: ends_at_utc
|
||||||
|
column_B: starts_at_utc
|
||||||
|
or_equal: True
|
||||||
|
|
||||||
|
columns:
|
||||||
|
- name: id_product_service_to_price
|
||||||
|
data_type: integer
|
||||||
|
description: |
|
||||||
|
Identifier of the product service to price. Acts as the primary key for this table.
|
||||||
|
tests:
|
||||||
|
- unique
|
||||||
|
- not_null
|
||||||
|
- name: id_product_service
|
||||||
|
data_type: integer
|
||||||
|
description: |
|
||||||
|
Identifier of the product service.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
- name: payment_type
|
||||||
|
data_type: string
|
||||||
|
description: |
|
||||||
|
Type of the payment, namely if the price represents a
|
||||||
|
percentage or an amount.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
- accepted_values:
|
||||||
|
values:
|
||||||
|
- "AMOUNT"
|
||||||
|
- "PERCENTAGE"
|
||||||
|
- name: price_base_unit
|
||||||
|
data_type: string
|
||||||
|
description: |
|
||||||
|
Represents how the price value should be taken into account, either
|
||||||
|
if the price is representing the total amount at booking level or
|
||||||
|
it's a nightly fee.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
- accepted_values:
|
||||||
|
values:
|
||||||
|
- "PER BOOKING"
|
||||||
|
- "PER NIGHT"
|
||||||
|
- name: invoicing_trigger
|
||||||
|
data_type: string
|
||||||
|
description: |
|
||||||
|
Represents at which moment in time this service should be invoiced.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
- accepted_values:
|
||||||
|
values:
|
||||||
|
- "PRE-BOOKING"
|
||||||
|
- "POST-CHECKOUT"
|
||||||
|
- "AT WAIVER PAYMENT"
|
||||||
|
- "AT DEPOSIT PAYMENT"
|
||||||
|
- "N/A"
|
||||||
|
- name: currency_code
|
||||||
|
data_type: string
|
||||||
|
description:
|
||||||
|
Currency iso4217 code. It identifies the currency for the amount stated in
|
||||||
|
amount_local_curr.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
- name: amount_local_curr
|
||||||
|
data_type: decimal
|
||||||
|
description: |
|
||||||
|
Price amount of a given product service in the currency stated in id_currency.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
- name: product_service_price_name
|
||||||
|
data_type: string
|
||||||
|
description: |
|
||||||
|
The name given to a product service to price, for example "Waiver Pro Default Price".
|
||||||
|
- name: product_service_name
|
||||||
|
data_type: string
|
||||||
|
description: |
|
||||||
|
The name of the product service, for example "Waiver Pro".
|
||||||
|
- name: starts_at_utc
|
||||||
|
data_type: timestamp
|
||||||
|
description: |
|
||||||
|
Timestamp of when this product service to price starts to be active.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
- name: ends_at_utc
|
||||||
|
data_type: timestamp
|
||||||
|
description: |
|
||||||
|
Timestamp of when this product service to price ends to be active.
|
||||||
|
It can be null, thus meaning it's currently active.
|
||||||
|
- name: has_no_end_date
|
||||||
|
data_type: boolean
|
||||||
|
description: |
|
||||||
|
True when ends_at_utc is not set, false otherwise.
|
||||||
|
- name: created_at_utc
|
||||||
|
data_type: timestamp
|
||||||
|
description: |
|
||||||
|
Timestamp of when this product service to price was created.
|
||||||
|
- name: created_date_utc
|
||||||
|
data_type: date
|
||||||
|
description: |
|
||||||
|
Date of when this product service to price was created.
|
||||||
|
- name: updated_at_utc
|
||||||
|
data_type: timestamp
|
||||||
|
description: |
|
||||||
|
Timestamp of when this product service to price was last updated.
|
||||||
|
- name: updated_date_utc
|
||||||
|
data_type: date
|
||||||
|
description: |
|
||||||
|
Date of when this product service to price was last updated.
|
||||||
|
- name: dwh_extracted_at_utc
|
||||||
|
data_type: timestamp
|
||||||
|
description: |
|
||||||
|
Timestamp of when this data was extracted into DWH.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue