英文:
How to use API offset pagination in Azure COPY ACTIVITY to dynamically stop when the last page has been processed
问题
I'm working on a data integration pipeline in Azure Data Factory, and I need to implement offset pagination for a copy activity. I have an API that returns a response with pagination information, and I want to use that information to perform offset pagination in the copy activity.
Here's an example of the API response:
{
"log_id": "3133A719-AB38-4846-1111-9D37AD9D682F",
"pagination": {
"next_page": 2,
"last_page": 2428,
"total_records": 24274,
"prev_page": 1,
"current_page": 1
},
"data": {
"ws_fin_out_header": [
{
"serial": "TST1400002"
},
{
"serial": "TST1400001"
}
]
},
"auth": true,
"success": true,
"message": null,
"uuid": "E0EB1293-1111-4505-A02D-950A6477CF53",
"version": "4",
"sqlResult": null,
"token_succes": true,
"benchmark": "request finished in 219 ms",
"token": false
}
I use QueryParameters {pageNumber} = Range(1, 2428,1) but the 2428 is now hardcoded. How do dynamically set the end of the range so that the copy activity stops when all is processed.
I already tried to work with "EndCondition": $.data.ws_fin_out_header = EMPTY. This did not work.
Any ideas how to set the offSet correctly and stop when done?
英文:
I'm working on a data integration pipeline in Azure Data Factory, and I need to implement offset pagination for a copy activity. I have an API that returns a response with pagination information, and I want to use that information to perform offset pagination in the copy activity.
Here's an example of the API response:
{
"log_id": "3133A719-AB38-4846-1111-9D37AD9D682F",
"pagination": {
"next_page": 2,
"last_page": 2428,
"total_records": 24274,
"prev_page": 1,
"current_page": 1
},
"data": {
"ws_fin_out_header": [
{
"serial": "TST1400002"
},
{
"serial": "TST1400001"
}
]
},
"auth": true,
"success": true,
"message": null,
"uuid": "E0EB1293-1111-4505-A02D-950A6477CF53",
"version": "4",
"sqlResult": null,
"token_succes": true,
"benchmark": "request finished in 219 ms",
"token": false
}
I use QueryParameters {pageNumber} = Range(1, 2428,1) but the 2428 is now hardcoded.
How do dynamically set the end of the range so that the copy activity stops when all is processed.
I already tried to work with "EndCondition": $.data.ws_fin_out_header = EMPTY. This did not work.
Any ideas how to set the offSet correctly and stop when done?
答案1
得分: 1
要实现你的情景,你可以直接将值传递给结束条件,在范围内停止分页,如下所示:
在你的条件中,它可以是$pagination.total_records
另外,你可以参考这个SO线程。
英文:
To achieve your scenario, you can directly pass the value to end condition and stop pagination in range as below:
In your condition it can be like $pagination.total_records
Also, you can refer this SO thread.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论