docs and tests
This commit is contained in:
parent
68a9eafb14
commit
624c70872f
1 changed files with 126 additions and 0 deletions
|
|
@ -391,3 +391,129 @@ models:
|
||||||
data_type: timestamp
|
data_type: timestamp
|
||||||
description: |
|
description: |
|
||||||
Timestamp of when this data was extracted into DWH.
|
Timestamp of when this data was extracted into DWH.
|
||||||
|
- name: stg_core__payaway
|
||||||
|
description: |
|
||||||
|
Contains all the PayAway plans, which are basically the settings for
|
||||||
|
host-takes-waiver plans with our host customers. All plans have a start
|
||||||
|
and end point in time, which means that any waivers that happen during
|
||||||
|
the range of plan should use the settings of this plan as a reference.
|
||||||
|
|
||||||
|
Plans can be open ended, as in not having a specified end in time. This
|
||||||
|
just means they are indefinitely active until someone changes it.
|
||||||
|
|
||||||
|
Plans can also have a planned end time which sits in the future.
|
||||||
|
tests:
|
||||||
|
- dbt_expectations.expect_column_pair_values_A_to_be_greater_than_B:
|
||||||
|
# The end timestamp should always be after the start timestamp
|
||||||
|
column_A: end_at_utc
|
||||||
|
column_B: start_at_utc
|
||||||
|
or_equal: False
|
||||||
|
- dbt_expectations.expect_column_pair_values_A_to_be_greater_than_B:
|
||||||
|
# The updated timestamp should always be equal or after the creation
|
||||||
|
# timestamp
|
||||||
|
column_A: updated_at_utc
|
||||||
|
column_B: created_at_utc
|
||||||
|
or_equal: True
|
||||||
|
|
||||||
|
columns:
|
||||||
|
- name: id_payaway_plan
|
||||||
|
data_type: bigint
|
||||||
|
description: The unique id for this plan.
|
||||||
|
tests:
|
||||||
|
- unique
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: id_currency
|
||||||
|
data_type: bigint
|
||||||
|
description: |
|
||||||
|
The Superhog ID of the currency that this record applies to.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: id_user_host
|
||||||
|
data_type: character varying
|
||||||
|
description: |
|
||||||
|
The Superhog ID of the host user this record applies to.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: start_at_utc
|
||||||
|
data_type: timestamp without time zone
|
||||||
|
description: |
|
||||||
|
The point in time in which this plan became active. It can never be
|
||||||
|
null.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: end_at_utc
|
||||||
|
data_type: timestamp without time zone
|
||||||
|
description: |
|
||||||
|
The point in time in which this plan will stop being active. It can be
|
||||||
|
null, which means the plan has no planned end date yet. Should this
|
||||||
|
column have a value, it should always be after the start time of the
|
||||||
|
plan.
|
||||||
|
|
||||||
|
- name: has_no_end_date
|
||||||
|
data_type: boolean
|
||||||
|
description: |
|
||||||
|
Syntactic sugar for checking if the plan has a specified end date.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: payaway_percentage
|
||||||
|
data_type: numeric
|
||||||
|
description: |
|
||||||
|
The percentage of the Waiver payments that Superhog will keep as a
|
||||||
|
a fee. Should be between 0% and a 100%. 0% is a valid amount.
|
||||||
|
|
||||||
|
This means that the Superhog fee is computed as:
|
||||||
|
Waiver Amount * payaway_percentage.
|
||||||
|
|
||||||
|
If the amount that comes out of this calculation is smaller than the
|
||||||
|
amount in column payaway_minimum_commission_local_curr, then the
|
||||||
|
Superhog fee becomes payaway_minimum_commission_local_curr instead.
|
||||||
|
So, the final logic becomes:
|
||||||
|
MAX(
|
||||||
|
Waiver Amount * payaway_percentage,
|
||||||
|
payaway_minimum_commission_local_curr
|
||||||
|
)
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
- dbt_expectations.expect_column_values_to_be_between:
|
||||||
|
min_value: 0
|
||||||
|
max_value: 1
|
||||||
|
strictly: false
|
||||||
|
|
||||||
|
- name: payaway_minimum_commission_local_curr
|
||||||
|
data_type: numeric
|
||||||
|
description: |
|
||||||
|
The minimum fee that we take from each waiver payment, specified in
|
||||||
|
the currency of the guest payment (so if this record is in dollars, it
|
||||||
|
means it applies to guest payments made in dollars). We will never
|
||||||
|
charge less than this. This can be 0.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
- dbt_expectations.expect_column_values_to_be_between:
|
||||||
|
min_value: 0
|
||||||
|
strictly: false
|
||||||
|
|
||||||
|
- name: created_at_utc
|
||||||
|
data_type: timestamp
|
||||||
|
description: |
|
||||||
|
Timestamp of when the pay away plan was created.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: updated_at_utc
|
||||||
|
data_type: timestamp
|
||||||
|
description: |
|
||||||
|
Timestamp of when the pay away plan to currency was last updated
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- 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