CREATE SINK alpheya_experience_bff.opportunity_resources_sink AS
SELECT
opportunity_id,
resource_id,
fact_date,
opportunity_resource,
name,
type_label_id,
priority,
CAST(days_to_expiry AS BIGINT),
expiry_date,
trigger_context
FROM opportunity.opportunity_resources_mv AS opportunity_resources_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='opportunity_resources',
schema='advisor_portal_bff',
type='upsert',
force_compaction='true',
primary_key='opportunity_id,resource_id,fact_date'
)