diff --git a/src/modules/platform-api/platform-api.controller.spec.ts b/src/modules/platform-api/platform-api.controller.spec.ts index ae4c352..57127ca 100644 --- a/src/modules/platform-api/platform-api.controller.spec.ts +++ b/src/modules/platform-api/platform-api.controller.spec.ts @@ -185,6 +185,27 @@ describe('PlatformApiController - addTable', () => { expect(addCdcTableOrder).toBeLessThan(addCdcJobsOrder); }); + it('addTable: carries iceberg_table_name on the added table through to AddCdcTable', async () => { + inputsService.addCdcTable.mockResolvedValue({ input: {} }); + pipelinesClientService.addCdcJobs.mockResolvedValue({ job_ids: ['p_3'], skipped: [] }); + + const icebergBody = { ...body, iceberg_table_name: 'cdc_raw.public__orders' }; + + await controller.addTable('pid', 'iid', icebergBody, mockUser); + + expect(inputsService.addCdcTable).toHaveBeenCalledWith({ + id: 'iid', + table: { + table_schema: 'public', + table_name: 'orders', + primary_keys: ['id'], + name: 'orders', + iceberg_table_name: 'cdc_raw.public__orders', + }, + info: { customer_id: 'c1', customer: 'cust', user_id: 'u1' }, + }); + }); + it('addTable: rolls back the DynamoDB row when AddJobs fails', async () => { inputsService.addCdcTable.mockResolvedValue({ input: {} }); pipelinesClientService.addCdcJobs.mockRejectedValue(new Error('platform down')); diff --git a/src/modules/platform-api/platform-api.controller.ts b/src/modules/platform-api/platform-api.controller.ts index e547b0d..8355ffa 100644 --- a/src/modules/platform-api/platform-api.controller.ts +++ b/src/modules/platform-api/platform-api.controller.ts @@ -1076,6 +1076,9 @@ export class PlatformApiController { raw: { table_schema: string; table_name: string }; qualify: { table_schema: string; table_name: string }; }; + // Iceberg destination only (protospack CdcTable.iceberg_table_name); + // absent for snowflake, back-compat. + iceberg_table_name?: string; }, @User() user: RequestUser, ) { @@ -1090,6 +1093,7 @@ export class PlatformApiController { table_name: body.table_name, primary_keys: body.primary_keys, name: body.table_name, + iceberg_table_name: body.iceberg_table_name, }; this.logger.info('addTable: appending CDC table to DynamoDB', { inputId, tableName: body.table_name });