CREATE SINK alpheya_experience_bff.report_flows_daily_sink AS
SELECT
portfolio_id,
account_group_type,
dim_transaction_date,
transaction_type,
currency_code,
net_flow,
net_flow_system_currency,
cumulative_net_flow
FROM alpheya_experience_bff.report_flows_daily_mv AS report_flows_daily_mv_next
WITH (
connector='postgres',
host='psql-nonprod-uae-derived.postgres.database.azure.com',
port='6432',
user='migration_user',
password='***',
database='ai-hub-int-alpheya-exp-bff',
table='report_flows_daily',
schema='advisor_portal_bff',
type='upsert',
force_compaction='true',
primary_key='portfolio_id,account_group_type,dim_transaction_date,transaction_type,currency_code'
)