Merged PR 2788: Update edeposit users table
# Description Created a mapping for some users that have a different id in Cosmos so we can join them using data that Ray shared with me, with this we can get all currency information for each user # 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. - [x] I've picked the right materialization for the affected models. # Other - [ ] Check if a full-refresh is required after this PR is merged. Related work items: #20125
This commit is contained in:
commit
d5151e2e90
4 changed files with 28 additions and 10 deletions
|
|
@ -3,6 +3,21 @@
|
|||
{% set rejected_fee = 0.25 %}
|
||||
{% set cancellation_fee = 0.25 %}
|
||||
{% set cancellation_threshold = 0.05 %}
|
||||
-- mapping of users that have a different id in Cosmos DB so we can join them
|
||||
{% set mapped_users = {
|
||||
"6580e7a6da7d1d09344c847d": "011339af-1206-4b4b-bd58-db2588381673",
|
||||
"3f6e171e-b6a3-4e5d-b178-309cd91fa704": "e2a34440-c382-4352-bb57-60e898752826",
|
||||
"hello-manhattanbnb-com": "b1e28c21-ddc2-4c2b-9207-62e248ff83aa",
|
||||
"9471281a-6404-4614-8cf3-66b1c24e6f24": "e2fa2f20-4fcf-4736-b5e5-f8b118ca98fe",
|
||||
} %}
|
||||
{% set user_mapping_case %}
|
||||
case
|
||||
{% for old_user, new_user in mapped_users.items() %}
|
||||
when v.id_user_partner = '{{ old_user }}' then '{{ new_user }}'
|
||||
{% endfor %}
|
||||
else v.id_user_partner
|
||||
end
|
||||
{% endset %}
|
||||
with
|
||||
int_edeposit__verifications as (
|
||||
select * from {{ ref("int_edeposit__verifications") }}
|
||||
|
|
@ -14,7 +29,7 @@ with
|
|||
edeposit_records as (
|
||||
select
|
||||
v.id_verification,
|
||||
v.id_user_partner,
|
||||
{{ user_mapping_case }} as id_user_partner,
|
||||
v.id_booking,
|
||||
eu.currency,
|
||||
cer.rate,
|
||||
|
|
|
|||
|
|
@ -220,7 +220,10 @@ models:
|
|||
columns:
|
||||
- name: id_verification
|
||||
data_type: text
|
||||
description: "unique Superhog generated id for this verification"
|
||||
description:
|
||||
"Unique Superhog generated id for this verification.
|
||||
Note that there are some users that have a different id in Cosmos.
|
||||
For those users we created a mapping to relate this ids."
|
||||
tests:
|
||||
- unique
|
||||
- not_null
|
||||
|
|
|
|||
|
|
@ -45,12 +45,13 @@ exposures:
|
|||
url: https://app.powerbi.com/groups/me/apps/33e55130-3a65-4fe8-86f2-11979fb2258a/reports/0642f366-c243-4879-8228-d8d6cc78f266/ReportSectionbd92a560d1aa856ba993?ctid=862842df-2998-4826-bea9-b726bc01d3a7&experience=power-bi
|
||||
|
||||
A PBI report showcasing our revenue coming from E-deposits and Guesty.
|
||||
Includes data from Xero for Guesty invoicing, and from a direct source to CosmosDB
|
||||
for the expected revenue generated for both Guesty and E-deposit. Note that currently
|
||||
CosmosDB is not integrated into the DWH.
|
||||
Includes data from Xero for Guesty invoicing, and data from CosmosDB
|
||||
extracted to the DWH for the expected revenue generated for both Guesty and E-deposit.
|
||||
|
||||
depends_on:
|
||||
- ref('xero__net_fees_by_deal')
|
||||
- ref('edeposit__guesty_verifications')
|
||||
- ref('edeposit__verification_fees')
|
||||
|
||||
owner:
|
||||
name: Oriol Roqué
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
-- test users to filter out. In the update on Q4 they should either be removed or a
|
||||
-- new field added to identify them.
|
||||
{% set test_users = (
|
||||
"b2a6a51c-af04-419c-97c1-e08e26710651",
|
||||
"742086df-537d-46b5-8865-548d85c3dc5c",
|
||||
|
|
@ -12,8 +14,6 @@
|
|||
"d327a19d-6111-4364-b27c-02253d093045",
|
||||
"61029f39-fb8a-4160-9353-d5d441147a42",
|
||||
) %}
|
||||
-- test users to filter out. In the update on Q4 they should either be removed or a
|
||||
-- new field added to identify them.
|
||||
with
|
||||
raw_electronic_deposit_user as (
|
||||
select * from {{ source("core", "ElectronicDepositUser") }}
|
||||
|
|
@ -21,11 +21,11 @@ with
|
|||
stg_core__edeposit_user as (
|
||||
select
|
||||
{{ adapter.quote("Id") }} as id,
|
||||
lower({{ adapter.quote("UserId") }}) as id_user_partner,
|
||||
upper(substring({{ adapter.quote("Currency") }} from 1 for 3)) as currency,
|
||||
{{ user_mapping_case }} as id_user_partner,
|
||||
-- this shitty thing right here is all because the currency is currently
|
||||
-- set up as a free text.
|
||||
-- they expect to fix this on the next update of E-deposit
|
||||
upper(substring({{ adapter.quote("Currency") }} from 1 for 3)) as currency,
|
||||
{{ adapter.quote("NightlyFee") }} as nightly_fee,
|
||||
{{ adapter.quote("CancellationFee") }} as cancellation_fee,
|
||||
{{ adapter.quote("ProtectionLowerLevel") }} as protection_lower_level,
|
||||
|
|
@ -33,7 +33,6 @@ with
|
|||
{{ adapter.quote("CreatedDate") }} as created_at_utc,
|
||||
{{ adapter.quote("UpdatedDate") }} as updated_at_utc,
|
||||
{{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_utc
|
||||
|
||||
from raw_electronic_deposit_user
|
||||
)
|
||||
select *
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue