more refactoring
This commit is contained in:
parent
1a347c721b
commit
c4b9c42a3c
2 changed files with 31 additions and 8 deletions
|
|
@ -5,15 +5,15 @@ with
|
||||||
stg_core__verification_payment_type as (
|
stg_core__verification_payment_type as (
|
||||||
select * from {{ ref("stg_core__verification_payment_type") }}
|
select * from {{ ref("stg_core__verification_payment_type") }}
|
||||||
),
|
),
|
||||||
|
int_core__verification_payments as (
|
||||||
|
select * from {{ ref("int_core__verification_payments") }}
|
||||||
|
),
|
||||||
monster_payment_join as (
|
monster_payment_join as (
|
||||||
select vtp.*, vpt.*, p.*, ps."Name"
|
select vp.*, p.*, ps."Name"
|
||||||
from stg_core__verification_to_payment vtp
|
from int_core__verification_payments vp
|
||||||
left join
|
left join sync_core."Payment" p on vp.id_payment = p."PaymentId"
|
||||||
stg_core__verification_payment_type vpt
|
|
||||||
on vtp.id_verification_to_payment = vpt.id_verification_payment_type
|
|
||||||
left join sync_core."Payment" p on vtp.id_payment = p."PaymentId"
|
|
||||||
left join sync_core."PaymentStatus" ps on p."PaymentStatusId" = ps."Id"
|
left join sync_core."PaymentStatus" ps on p."PaymentStatusId" = ps."Id"
|
||||||
where vpt.verification_payment_type = 'Fee'
|
where vp.verification_payment_type = 'Fee'
|
||||||
)
|
)
|
||||||
select payment_due_at_utc, "Amount" as amount
|
select *
|
||||||
from monster_payment_join
|
from monster_payment_join
|
||||||
|
|
|
||||||
23
models/intermediate/int_core__verification_payments.sql
Normal file
23
models/intermediate/int_core__verification_payments.sql
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
with
|
||||||
|
stg_core__verification_to_payment as (
|
||||||
|
select * from {{ ref("stg_core__verification_to_payment") }}
|
||||||
|
),
|
||||||
|
stg_core__verification_payment_type as (
|
||||||
|
select * from {{ ref("stg_core__verification_payment_type") }}
|
||||||
|
)
|
||||||
|
|
||||||
|
select
|
||||||
|
vtp.id_verification_to_payment,
|
||||||
|
vtp.id_payment,
|
||||||
|
vtp.is_refundable,
|
||||||
|
vtp.created_at_utc,
|
||||||
|
vtp.updated_at_utc,
|
||||||
|
vtp.refund_due_at_utc,
|
||||||
|
vtp.payment_due_at_utc,
|
||||||
|
vtp.id_superhog_user,
|
||||||
|
vtp.id_verification,
|
||||||
|
vpt.verification_payment_type
|
||||||
|
from stg_core__verification_to_payment vtp
|
||||||
|
left join
|
||||||
|
stg_core__verification_payment_type vpt
|
||||||
|
on vtp.id_verification_payment_type = vpt.id_verification_payment_type
|
||||||
Loading…
Add table
Add a link
Reference in a new issue