mirror of
https://gitlab.com/cief-data/dbt_cloud.git
synced 2026-08-19 04:14:00 +00:00
53 lines
1.5 KiB
SQL
53 lines
1.5 KiB
SQL
-- IMPORTS
|
|
WITH bookings AS (
|
|
SELECT * FROM {{ source('src_exchange_mysql', 'bookings') }}
|
|
),
|
|
|
|
|
|
-- LOGIC
|
|
bookings_rename AS (
|
|
|
|
SELECT
|
|
bookings.id,
|
|
bookings.company_id,
|
|
bookings.marking AS marking_id,
|
|
bookings.service_id AS service_type,
|
|
bookings.bank_id,
|
|
bookings.fix_amount AS fix_value,
|
|
bookings.fix_currency_id,
|
|
bookings.convertible_currency_id AS quote_currency_id,
|
|
bookings.conversion_currency_id AS base_currency_id,
|
|
bookings.status,
|
|
bookings.deleted_at,
|
|
bookings.created_at,
|
|
bookings.updated_at,
|
|
current_timestamp() AS _dbt_ran_at
|
|
|
|
FROM bookings
|
|
|
|
),
|
|
|
|
-- FINAL
|
|
final_base_exchange__bookings AS (
|
|
|
|
SELECT
|
|
id,
|
|
company_id,
|
|
marking_id,
|
|
service_type,
|
|
bank_id,
|
|
fix_value,
|
|
fix_currency_id,
|
|
quote_currency_id,
|
|
base_currency_id,
|
|
status,
|
|
deleted_at,
|
|
created_at,
|
|
updated_at,
|
|
_dbt_ran_at
|
|
|
|
FROM bookings_rename
|
|
|
|
)
|
|
|
|
SELECT * FROM final_base_exchange__bookings |