mirror of
https://gitlab.com/cief-data/dbt_cloud.git
synced 2026-08-19 04:14:00 +00:00
White Form
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
One order can have multiple bookings.
|
||||
Therefore, multiple china bank slip can be uploaded to one order, which is associated to each booking.
|
||||
Currency_vendor_payment_proof will always have pending_verification as their status.
|
||||
*/
|
||||
|
||||
-- IMPORT
|
||||
WITH documents AS (
|
||||
SELECT * FROM {{ ref('base_exchange__documents') }}
|
||||
),
|
||||
|
||||
seed_status AS (
|
||||
SELECT * FROM {{ ref('seed_exchange__status') }}
|
||||
WHERE category = 'DEFAULT'
|
||||
),
|
||||
|
||||
|
||||
-- LOGIC
|
||||
documents_join_status AS (
|
||||
|
||||
SELECT
|
||||
documents.document_id,
|
||||
documents.owner_id AS transaction_cost_id,
|
||||
documents.document_type,
|
||||
seed_status.name AS status,
|
||||
documents.created_datetime,
|
||||
documents.updated_datetime,
|
||||
documents.deleted_datetime,
|
||||
|
||||
'{{ modules.datetime.datetime.now(modules.pytz.timezone("Asia/Kuala_Lumpur")) }}' AS _dbt_ran_datetime
|
||||
|
||||
FROM documents
|
||||
|
||||
LEFT JOIN seed_status
|
||||
ON (documents.status = seed_status.id)
|
||||
|
||||
WHERE
|
||||
documents.document_type = 'CURRENCY_VENDOR_PAYMENT_PROOF'
|
||||
AND
|
||||
deleted_datetime IS NULL
|
||||
|
||||
),
|
||||
|
||||
|
||||
-- FINAL
|
||||
final__stg_exchange__currency_vendor_payment_proof AS (
|
||||
|
||||
SELECT
|
||||
-- ids
|
||||
document_id,
|
||||
transaction_cost_id,
|
||||
|
||||
-- dimensions
|
||||
document_type,
|
||||
status,
|
||||
|
||||
-- measures
|
||||
|
||||
-- date/times
|
||||
created_datetime,
|
||||
updated_datetime,
|
||||
deleted_datetime,
|
||||
|
||||
-- metadata
|
||||
_dbt_ran_datetime
|
||||
|
||||
FROM documents_join_status
|
||||
|
||||
)
|
||||
|
||||
SELECT * FROM final__stg_exchange__currency_vendor_payment_proof
|
||||
Reference in New Issue
Block a user