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

48 lines
891 B
SQL

-- IMPORTS
WITH contacts AS (
SELECT * FROM {{ source('src_exchange_mysql', 'contacts') }}
),
-- LOGIC
companies_rename AS (
SELECT
contacts.id,
contacts.company_id,
contacts.country_id,
contacts.reference,
contacts.phone,
contacts.email,
contacts.wechat_id,
contacts.deleted_at,
contacts.created_at,
contacts.updated_at,
current_timestamp() AS _dbt_ran_at
FROM contacts
),
-- FINAL
final__base_exchange__contacts AS (
SELECT
id,
company_id,
country_id,
reference,
phone,
email,
wechat_id,
deleted_at,
created_at,
updated_at,
_dbt_ran_at
FROM companies_rename
)
SELECT * FROM final__base_exchange__contacts