mirror of
https://gitlab.com/cief-data/dbt_cloud.git
synced 2026-08-19 04:14:00 +00:00
Exclude Internal Purchase
This commit is contained in:
@@ -5,28 +5,42 @@ WITH bookings AS (
|
||||
|
||||
|
||||
-- LOGIC
|
||||
bookings_rename AS (
|
||||
|
||||
-- Exclude service type 'Internal Purchase'
|
||||
exclude_service_type AS (
|
||||
|
||||
SELECT
|
||||
bookings.id AS booking_id,
|
||||
bookings.company_id,
|
||||
bookings.marking AS booking_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 AS deleted_datetime,
|
||||
bookings.created_at AS created_datetime,
|
||||
bookings.updated_at As updated_datetime,
|
||||
'{{ modules.datetime.datetime.now(modules.pytz.timezone("Asia/Kuala_Lumpur")) }}' AS _dbt_ran_datetime
|
||||
*
|
||||
|
||||
FROM bookings
|
||||
|
||||
WHERE service_id NOT IN (7) -- 7 : INTERNAL PURCHASE
|
||||
|
||||
),
|
||||
|
||||
bookings_rename AS (
|
||||
|
||||
SELECT
|
||||
exclude_service_type.id AS booking_id,
|
||||
exclude_service_type.company_id,
|
||||
exclude_service_type.marking AS booking_marking_id,
|
||||
exclude_service_type.service_id AS service_type,
|
||||
exclude_service_type.bank_id,
|
||||
exclude_service_type.fix_amount AS fix_value,
|
||||
exclude_service_type.fix_currency_id,
|
||||
exclude_service_type.convertible_currency_id AS quote_currency_id,
|
||||
exclude_service_type.conversion_currency_id AS base_currency_id,
|
||||
exclude_service_type.status,
|
||||
exclude_service_type.deleted_at AS deleted_datetime,
|
||||
exclude_service_type.created_at AS created_datetime,
|
||||
exclude_service_type.updated_at As updated_datetime,
|
||||
|
||||
'{{ modules.datetime.datetime.now(modules.pytz.timezone("Asia/Kuala_Lumpur")) }}' AS _dbt_ran_datetime
|
||||
|
||||
FROM exclude_service_type
|
||||
|
||||
),
|
||||
|
||||
|
||||
-- FINAL
|
||||
final_base_exchange__bookings AS (
|
||||
|
||||
|
||||
Reference in New Issue
Block a user