Files
dbt_cloud/models/exchange/base/wallets/base_exchange__wallets.sql
T
2023-03-28 23:57:11 +08:00

45 lines
825 B
SQL

-- IMPORTS
WITH wallets AS (
SELECT * FROM {{ source('src_exchange_mysql', 'wallets') }}
),
-- LOGIC
wallets_rename AS (
SELECT
wallets.id,
wallets.owner_type,
wallets.owner_id,
wallets.code,
wallets.currency_id,
wallets.amount,
wallets.deleted_at,
wallets.created_at,
wallets.updated_at,
current_timestamp() AS _dbt_ran_at
FROM wallets
),
-- FINAL
final__base_exchange__wallets AS (
SELECT
id,
owner_type,
owner_id,
code,
currency_id,
amount,
deleted_at,
created_at,
updated_at,
_dbt_ran_at
FROM wallets_rename
)
SELECT * FROM final__base_exchange__wallets