CREATE SINK ai_hub_bff.clients_sink AS
SELECT
client_id,
client_type,
base_currency_code,
created_at,
onboarding_date,
account_group_type,
display_name,
local_display_name,
preferred_name,
prefix,
suffix,
first_name,
last_name,
customer_identification_file,
segment_label_id,
status_label_id
FROM ai_hub_bff.book_of_business_clients_mv
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='clients',
schema='advisor_portal_bff',
type='upsert',
force_compaction='true',
primary_key='client_id,account_group_type'
)