Fixed data_types and added tests
This commit is contained in:
parent
d6dcbcc67e
commit
fc85dd9e70
2 changed files with 98 additions and 37 deletions
|
|
@ -195,8 +195,12 @@ models:
|
|||
description: "If the host has collected a deposit from the guest."
|
||||
|
||||
- name: deposit_retained_amount_in_txn_currency
|
||||
data_type: text
|
||||
data_type: numeric
|
||||
description: "Amount of the deposit retained in local currency."
|
||||
data_tests:
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
strictly: false
|
||||
|
||||
- name: deposit_retained_currency
|
||||
data_type: text
|
||||
|
|
@ -213,9 +217,13 @@ models:
|
|||
or further damage once identified"
|
||||
|
||||
- name: guest_contribution_amount_in_txn_currency
|
||||
data_type: text
|
||||
data_type: numeric
|
||||
description: "Amount of the guest contribution, in case they did,
|
||||
in local currency."
|
||||
data_tests:
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
strictly: false
|
||||
|
||||
- name: guest_contribution_currency
|
||||
data_type: text
|
||||
|
|
@ -325,8 +333,12 @@ models:
|
|||
description: ""
|
||||
|
||||
- name: number_of_guests
|
||||
data_type: text
|
||||
data_type: numeric
|
||||
description: "Number of guests in the booking."
|
||||
data_tests:
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
strictly: false
|
||||
|
||||
- name: booking_services
|
||||
data_type: text
|
||||
|
|
@ -387,36 +399,66 @@ models:
|
|||
description: "Guest verification status for this booking."
|
||||
|
||||
- name: lower_protection_limit_usd
|
||||
data_type: text
|
||||
data_type: numeric
|
||||
description: "Lower protection limit in USD."
|
||||
data_tests:
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
strictly: false
|
||||
|
||||
- name: upper_protection_limit_usd
|
||||
data_type: numeric
|
||||
description: "Upper protection limit in USD."
|
||||
data_tests:
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
strictly: false
|
||||
|
||||
- name: calculated_payout_amount_in_txn_currency
|
||||
data_type: numeric
|
||||
description: "Calculated payout amount in local currency."
|
||||
data_tests:
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
strictly: false
|
||||
|
||||
- name: calculated_payout_currency
|
||||
data_type: text
|
||||
description: "Currency of the calculated payout amount."
|
||||
data_tests:
|
||||
- not_null:
|
||||
where: "calculated_payout_amount_in_txn_currency > 0"
|
||||
|
||||
- name: calculated_payout_amount_in_usd
|
||||
data_type: numeric
|
||||
description: "Calculated payout amount in USD."
|
||||
data_tests:
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
strictly: false
|
||||
|
||||
- name: calculated_guest_charge_amount_in_txn_currency
|
||||
data_type: numeric
|
||||
description: "Calculated guest charge amount in local currency."
|
||||
data_tests:
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
strictly: false
|
||||
|
||||
- name: calculated_guest_charge_currency
|
||||
data_type: text
|
||||
description: "Currency of the calculated guest charge amount."
|
||||
data_tests:
|
||||
- not_null:
|
||||
where: "calculated_guest_charge_amount_in_txn_currency > 0"
|
||||
|
||||
- name: calculated_guest_charge_amount_in_usd
|
||||
data_type: numeric
|
||||
description: "Calculated guest charge amount in USD."
|
||||
data_tests:
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
strictly: false
|
||||
|
||||
- name: third_party_claim_submitted
|
||||
data_type: boolean
|
||||
|
|
@ -427,14 +469,21 @@ models:
|
|||
description: "For example, Aircover from Airbnb."
|
||||
|
||||
- name: third_party_claim_amount_in_txn_currency
|
||||
data_type: text
|
||||
data_type: numeric
|
||||
description: "Claim amount in local currency if the host is seeking
|
||||
compensation from another platform."
|
||||
data_tests:
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
strictly: false
|
||||
|
||||
- name: third_party_claim_currency
|
||||
data_type: text
|
||||
description: "Currency of the claim amount if the host is seeking
|
||||
compensation from another platform."
|
||||
data_tests:
|
||||
- not_null:
|
||||
where: "third_party_claim_amount_in_txn_currency > 0"
|
||||
|
||||
- name: cosmos_db_timestamp_utc
|
||||
data_type: timestamp
|
||||
|
|
|
|||
|
|
@ -82,10 +82,9 @@ select
|
|||
(
|
||||
{{ adapter.quote("documents") }} -> 'Guest' -> 'Deposit' ->> 'IsCollected'
|
||||
)::boolean as is_guest_deposit_collected,
|
||||
{{ adapter.quote("documents") }}
|
||||
-> 'Guest'
|
||||
-> 'Deposit'
|
||||
->> 'RetainedAmount' as deposit_retained_amount_in_txn_currency,
|
||||
(
|
||||
{{ adapter.quote("documents") }} -> 'Guest' -> 'Deposit' ->> 'RetainedAmount'
|
||||
)::numeric as deposit_retained_amount_in_txn_currency,
|
||||
{{ adapter.quote("documents") }}
|
||||
-> 'Guest'
|
||||
-> 'Deposit'
|
||||
|
|
@ -104,10 +103,12 @@ select
|
|||
-> 'Involvements'
|
||||
->> 'PreventativeSteps'
|
||||
)::boolean as has_host_taken_preventative_steps,
|
||||
{{ adapter.quote("documents") }}
|
||||
-> 'Guest'
|
||||
-> 'Involvements'
|
||||
->> 'ContributionAmount' as guest_contribution_amount_in_txn_currency,
|
||||
(
|
||||
{{ adapter.quote("documents") }}
|
||||
-> 'Guest'
|
||||
-> 'Involvements'
|
||||
->> 'ContributionAmount'
|
||||
)::numeric as guest_contribution_amount_in_txn_currency,
|
||||
{{ adapter.quote("documents") }}
|
||||
-> 'Guest'
|
||||
-> 'Involvements'
|
||||
|
|
@ -171,9 +172,8 @@ select
|
|||
{{ adapter.quote("documents") }}
|
||||
-> 'Reservation'
|
||||
->> 'BookingDetails' as booking_details,
|
||||
{{ adapter.quote("documents") }}
|
||||
-> 'Reservation'
|
||||
->> 'NumberOfGuests' as number_of_guests,
|
||||
({{ adapter.quote("documents") }} -> 'Reservation' ->> 'NumberOfGuests')::numeric
|
||||
as number_of_guests,
|
||||
{{ adapter.quote("documents") }}
|
||||
-> 'Reservation'
|
||||
->> 'BookingServices' as booking_services,
|
||||
|
|
@ -221,30 +221,42 @@ select
|
|||
{{ adapter.quote("documents") }}
|
||||
-> 'SavedCalculation'
|
||||
->> 'GuestVerificationStatus' as guest_verification_status,
|
||||
{{ adapter.quote("documents") }}
|
||||
-> 'SavedCalculation'
|
||||
->> 'LowerProtectionLimitUsd' as lower_protection_limit_usd,
|
||||
{{ adapter.quote("documents") }}
|
||||
-> 'SavedCalculation'
|
||||
->> 'UpperProtectionLimitUsd' as upper_protection_limit_usd,
|
||||
{{ adapter.quote("documents") }}
|
||||
-> 'SavedCalculation'
|
||||
->> 'SubmittedHostPayoutAmount' as calculated_payout_amount_in_txn_currency,
|
||||
(
|
||||
{{ adapter.quote("documents") }}
|
||||
-> 'SavedCalculation'
|
||||
->> 'LowerProtectionLimitUsd'
|
||||
)::numeric as lower_protection_limit_usd,
|
||||
(
|
||||
{{ adapter.quote("documents") }}
|
||||
-> 'SavedCalculation'
|
||||
->> 'UpperProtectionLimitUsd'
|
||||
)::numeric as upper_protection_limit_usd,
|
||||
(
|
||||
{{ adapter.quote("documents") }}
|
||||
-> 'SavedCalculation'
|
||||
->> 'SubmittedHostPayoutAmount'
|
||||
)::numeric as calculated_payout_amount_in_txn_currency,
|
||||
{{ adapter.quote("documents") }}
|
||||
-> 'SavedCalculation'
|
||||
->> 'SubmittedHostPayoutCurrency' as calculated_payout_currency,
|
||||
{{ adapter.quote("documents") }}
|
||||
-> 'SavedCalculation'
|
||||
->> 'CalculatedHostPayoutAmountInUsd' as calculated_payout_amount_in_usd,
|
||||
{{ adapter.quote("documents") }}
|
||||
-> 'SavedCalculation'
|
||||
->> 'SubmittedGuestChargeAmount' as calculated_guest_charge_amount_in_txn_currency,
|
||||
(
|
||||
{{ adapter.quote("documents") }}
|
||||
-> 'SavedCalculation'
|
||||
->> 'CalculatedHostPayoutAmountInUsd'
|
||||
)::numeric as calculated_payout_amount_in_usd,
|
||||
(
|
||||
{{ adapter.quote("documents") }}
|
||||
-> 'SavedCalculation'
|
||||
->> 'SubmittedGuestChargeAmount'
|
||||
)::numeric as calculated_guest_charge_amount_in_txn_currency,
|
||||
{{ adapter.quote("documents") }}
|
||||
-> 'SavedCalculation'
|
||||
->> 'SubmittedGuestChargeCurrency' as calculated_guest_charge_currency,
|
||||
{{ adapter.quote("documents") }}
|
||||
-> 'SavedCalculation'
|
||||
->> 'CalculatedGuestChargeAmountInUsd' as calculated_guest_charge_amount_in_usd,
|
||||
(
|
||||
{{ adapter.quote("documents") }}
|
||||
-> 'SavedCalculation'
|
||||
->> 'CalculatedGuestChargeAmountInUsd'
|
||||
)::numeric as calculated_guest_charge_amount_in_usd,
|
||||
|
||||
-- Third Party Compensation Claim
|
||||
(
|
||||
|
|
@ -255,9 +267,9 @@ select
|
|||
{{ adapter.quote("documents") }}
|
||||
-> 'ThirdPartyCompensationClaim'
|
||||
->> 'From' as third_party_claim_from,
|
||||
{{ adapter.quote("documents") }}
|
||||
-> 'ThirdPartyCompensationClaim'
|
||||
->> 'Amount' as third_party_claim_amount_in_txn_currency,
|
||||
(
|
||||
{{ adapter.quote("documents") }} -> 'ThirdPartyCompensationClaim' ->> 'Amount'
|
||||
)::numeric as third_party_claim_amount_in_txn_currency,
|
||||
{{ adapter.quote("documents") }}
|
||||
-> 'ThirdPartyCompensationClaim'
|
||||
->> 'Currency' as third_party_claim_currency,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue