mirror of
https://gitlab.com/cief-data/dbt_cloud.git
synced 2026-08-22 13:54:11 +00:00
56 lines
1.3 KiB
SQL
56 lines
1.3 KiB
SQL
-- IMPORTS
|
|
WITH packages AS (
|
|
SELECT * FROM {{ source('src_shipping_mysql', 'packages') }}
|
|
),
|
|
|
|
|
|
-- LOGIC
|
|
packages_rename AS (
|
|
|
|
SELECT
|
|
packages.id,
|
|
packages.packing_list_id,
|
|
packages.type,
|
|
packages.reference,
|
|
packages.description,
|
|
packages.width,
|
|
packages.height,
|
|
packages.length,
|
|
packages.weight,
|
|
packages.quantity,
|
|
packages.status,
|
|
packages.deleted_at AS deleted_datetime,
|
|
packages.created_at AS created_datetime,
|
|
packages.updated_at AS updated_datetime,
|
|
current_timestamp() AS _dbt_ran_at
|
|
|
|
FROM packages
|
|
|
|
),
|
|
|
|
|
|
-- FINAL
|
|
final__base_shipping__packages AS (
|
|
|
|
SELECT
|
|
id,
|
|
packing_list_id,
|
|
type,
|
|
reference,
|
|
description,
|
|
width,
|
|
height,
|
|
length,
|
|
weight,
|
|
quantity,
|
|
status,
|
|
deleted_datetime,
|
|
created_datetime,
|
|
updated_datetime,
|
|
_dbt_ran_at
|
|
|
|
FROM packages_rename
|
|
|
|
)
|
|
|
|
SELECT * FROM final__base_shipping__packages |