some progress
This commit is contained in:
parent
f911912b45
commit
606eed9754
4 changed files with 35 additions and 7 deletions
|
|
@ -1,13 +1,16 @@
|
|||
with
|
||||
stg_core__verification_to_payment as (
|
||||
select * from {{ ref("stg_core__verification_to_payment") }}
|
||||
),
|
||||
monster_payment_join as (
|
||||
select vtp.*, vpt.*, p.*, ps."Name"
|
||||
from sync_core."VerificationToPayment" vtp
|
||||
from stg_core__verification_to_payment vtp
|
||||
left join
|
||||
sync_core."VerificationPaymentType" vpt
|
||||
on vtp."VerificationPaymentTypeId" = vpt."Id"
|
||||
left join sync_core."Payment" p on vtp."PaymentId" = p."PaymentId"
|
||||
on vtp.id_verification_to_payment = vpt."Id"
|
||||
left join sync_core."Payment" p on vtp.id_payment = p."PaymentId"
|
||||
left join sync_core."PaymentStatus" ps on p."PaymentStatusId" = ps."Id"
|
||||
where vpt."Name" = 'Fee'
|
||||
where vpt."Name" = 'Fee' -- and vtp."VerificationId" = 800000
|
||||
)
|
||||
select cast("PaymentDueDate" as date) as paymenent_due_at_utc, "Amount" as amount
|
||||
select payment_due_at_utc, "Amount" as amount
|
||||
from monster_payment_join
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
with
|
||||
date_master as (select * from {{ ref("int_dates") }}),
|
||||
fee_txns as (select * from {{ ref("int_core__guest_fee_txns") }})
|
||||
select date_master.date_day, coalesce(sum(fee_txns.amount), 0)
|
||||
select date_master.date_day as date, coalesce(sum(fee_txns.amount), 0)
|
||||
from date_master
|
||||
left join fee_txns on date_master.date_day = fee_txns.paymenent_due_at_utc
|
||||
left join fee_txns on date_master.date_day = fee_txns.payment_due_at_utc
|
||||
where date_day between '2022-01-01' and '2024-12-31'
|
||||
group by date_master.date_day
|
||||
order by 2 desc
|
||||
|
|
|
|||
|
|
@ -169,3 +169,5 @@ sources:
|
|||
description: "{{ doc('_airbyte_meta_desc') }}"
|
||||
- name: superhog_user
|
||||
identifier: SuperhogUser
|
||||
- name: VerificationToPayment
|
||||
identifier: VerificationToPayment
|
||||
|
|
|
|||
23
models/staging/core/stg_core__verification_to_payment.sql
Normal file
23
models/staging/core/stg_core__verification_to_payment.sql
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
with
|
||||
raw_verificationtopayment as (
|
||||
select * from {{ source("core", "VerificationToPayment") }}
|
||||
),
|
||||
stg_core__verification_to_payment as (
|
||||
select
|
||||
{{ adapter.quote("Id") }} as id_verification_to_payment,
|
||||
{{ adapter.quote("PaymentId") }} as id_payment,
|
||||
{{ adapter.quote("Refundable") }} as is_refundable,
|
||||
{{ adapter.quote("CreatedDate") }} as created_at_utc,
|
||||
{{ adapter.quote("UpdatedDate") }} as updated_at_utc,
|
||||
{{ adapter.quote("RefundDueDate") }} as refund_due_at_utc,
|
||||
{{ adapter.quote("PaymentDueDate") }} as payment_due_at_utc,
|
||||
{{ adapter.quote("SuperhogUserId") }} as id_superhog_user,
|
||||
{{ adapter.quote("VerificationId") }} as id_verification,
|
||||
{{ adapter.quote("VerificationPaymentTypeId") }}
|
||||
as id_verification_payment_type,
|
||||
{{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_date_utc
|
||||
|
||||
from raw_verificationtopayment
|
||||
)
|
||||
select *
|
||||
from stg_core__verification_to_payment
|
||||
Loading…
Add table
Add a link
Reference in a new issue