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:
Joaquin Ossa 2024-09-10 08:35:37 +00:00 committed by Pablo Martín
commit d5151e2e90
4 changed files with 28 additions and 10 deletions

View file

@ -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,

View file

@ -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