CREATE SINK alpheya_experience_bff.report_allocation_daily_sink AS
SELECT
portfolio_id,
account_group_type,
dim_balance_date,
distribution_type,
item_id,
taxonomy_node_id,
item_name_en,
item_name_ar,
currency_code,
market_value,
fair_value,
market_value_system_currency,
fair_value_system_currency,
weight,
fair_value_weight
FROM alpheya_experience_bff.report_allocation_daily_mv AS report_allocation_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_allocation_daily',
schema='advisor_portal_bff',
type='upsert',
force_compaction='true',
primary_key='portfolio_id,account_group_type,dim_balance_date,distribution_type,item_id,currency_code'
)