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

53 lines
1.1 KiB
SQL

-- IMPORTS
WITH notifications AS (
SELECT * FROM {{ source('src_exchange_mysql', 'notifications') }}
),
-- LOGIC
notifications_rename AS (
SELECT
notifications.id,
notifications.title,
notifications.description,
notifications.subject_type,
notifications.subject_id,
notifications.target_type,
notifications.target_id,
notifications.causer_type,
notifications.causer_id,
notifications.status,
notifications.deleted_at,
notifications.created_at,
notifications.updated_at,
current_timestamp() AS _dbt_ran_at
FROM notifications
),
-- FINAL
final__base_exchange__notifications AS (
SELECT
id,
title,
description,
subject_type,
subject_id,
target_type,
target_id,
causer_type,
causer_id,
status,
deleted_at,
created_at,
updated_at,
_dbt_ran_at
FROM notifications_rename
)
SELECT * FROM final__base_exchange__notifications