CREATE SINK alinma_bff.transactions_sink AS
SELECT
entity_type,
entity_id,
account_group_type,
transaction_id,
account_id,
asset_id,
transaction_type,
status_id,
side_id,
currency_code,
quantity,
unit_price,
gross_value,
net_value,
external_reference,
creation_timestamp,
valuation_timestamp,
settlement_timestamp,
type_id,
order_id,
description,
source_asset_id,
source_account_id,
fee_type,
fee_currency_code,
fee_amount,
fee_amount_system_currency,
order_side_id,
custom_fields
FROM alinma_bff.book_of_business_transactions_mv AS book_of_business_transactions_mv_next
WITH (
connector='postgres',
host='psql-nonprod-uae-derived.postgres.database.azure.com',
port='6432',
user='migration_user',
password='***',
database='alinma-int-advisor-portal-bff',
table='transactions',
schema='advisor_portal_bff',
type='upsert',
force_compaction='true',
primary_key='entity_type,entity_id,account_group_type,transaction_id,account_id'
)