CREATE SINK insights.position_summary_sink AS
SELECT
account_group_id,
position_type AS type,
dim_balance_date,
currency_code,
market_value,
total_average_cost,
fair_value,
fair_value_system_currency,
accrued_value,
accrued_value_system_currency,
market_value_system_currency,
total_average_cost_system_currency,
relationship_value,
fair_relationship_value,
relationship_value_system_currency,
fair_relationship_value_system_currency
FROM insights.position_summary_mv
WITH (
connector='postgres',
host='psql-nonprod-uae-derived.postgres.database.azure.com',
port='6432',
user='migration_user',
password='***',
database='adib-int-insights-db',
table='account_group_balances_ft',
schema='insights',
type='upsert',
force_compaction='true',
primary_key='account_group_id,type,dim_balance_date'
)