mirror of
https://gitlab.com/cief-data/dbt_cloud.git
synced 2026-08-29 01:04:16 +00:00
50 lines
1.3 KiB
SQL
50 lines
1.3 KiB
SQL
-- IMPORTS
|
|
WITH contacts AS (
|
|
SELECT * FROM {{ source('src_shipping_mysql', 'contacts') }}
|
|
),
|
|
|
|
|
|
-- LOGIC
|
|
contacts_rename AS (
|
|
|
|
SELECT
|
|
contacts.id,
|
|
contacts.owner_type,
|
|
contacts.owner_id,
|
|
contacts.reference,
|
|
contacts.phone,
|
|
contacts.email,
|
|
contacts.wechat_id,
|
|
contacts.default AS is_default,
|
|
contacts.deleted_at AS deleted_datetime,
|
|
contacts.created_at AS created_datetime,
|
|
contacts.updated_at AS updated_datetime,
|
|
current_timestamp() AS _dbt_ran_at
|
|
|
|
FROM contacts
|
|
|
|
),
|
|
|
|
|
|
-- FINAL
|
|
final__base_shipping__contacts AS (
|
|
|
|
SELECT
|
|
id,
|
|
owner_type,
|
|
owner_id,
|
|
reference,
|
|
phone,
|
|
email,
|
|
wechat_id,
|
|
is_default,
|
|
deleted_datetime,
|
|
created_datetime,
|
|
updated_datetime,
|
|
_dbt_ran_at
|
|
|
|
FROM contacts_rename
|
|
|
|
)
|
|
|
|
SELECT * FROM final__base_shipping__contacts |