Hello Ashwani SRIVASTAVA,
Please follow the below steps.
1). Disable and enable the CDC instance on the source database.
SalesLT.Product table from AdventureWorks is used as an example below.
disable
EXEC sys.sp_cdc_disable_table @source_schema = N'SalesLT', @source_name = N'Product', @capture_instance = N'SalesLT_Product' GO
To verify CDC is disabled (no CDC configuration shows up if disabled on that table)
exec sys.sp_cdc_help_change_data_capture go
enable again
EXEC sys.sp_cdc_enable_table @source_schema = N'SalesLT', @source_name = N'Product', @role_name = NULL, @filegroup_name = NULL, @supports_net_changes = 1
2). Import the new schema in the ADF mapping data flow.
Ex:HolidaySalesDeal column, which is added on the database
- Add alterRows transformation in the mapping data flow. Condition is [Upsert if] [isInsert(1)]
4). Override the checkpoint key with unique value.
- Run the pipeline and confirm the changed data is populated in the target sink.
Reference documents:
https://learn.microsoft.com/en-us/azure/azure-sql/database/change-data-capture-overview?view=azuresql
https://learn.microsoft.com/en-us/azure/data-factory/concepts-change-data-capture
Please note:
ADF doesn't fully support schema evolution from end to end.
Schema evolution, which table schema changes such as adding columns, is not fully supported by SQL native CDC. ADF mapping data flow has schema drift and auto mapping feature, but it can’t absorb this feature gap.
Hence, the added column, changed data are not detected automatically.
I hope this answers your question. Please let me know in case if you have any further questions.