CREATE SINK insights.benchmark_twrr_by_asset_class_sink AS
SELECT
benchmark_id,
fact_date,
item_id AS asset_class,
daily_subperiod_return
FROM insights.benchmark_twrr_by_distribution_mv
WHERE
distribution_type = 'asset_classes'
WITH (
connector='postgres',
host='psql-nonprod-uae-derived.postgres.database.azure.com',
port='6432',
user='migration_user',
password='***',
database='adib-int-insights-db',
table='benchmark_twrr_metrics_by_asset_classes_ft',
schema='insights',
type='upsert',
force_compaction='true',
primary_key='benchmark_id,fact_date,asset_class'
)