如何在Azure复制活动中使用API偏移分页以在处理完最后一页时动态停止。

huangapple go评论52阅读模式
英文:

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

如何在Azure复制活动中使用API偏移分页以在处理完最后一页时动态停止。

另外,你可以参考这个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

如何在Azure复制活动中使用API偏移分页以在处理完最后一页时动态停止。

Also, you can refer this SO thread.

huangapple
  • 本文由 发表于 2023年5月14日 02:16:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/76244261.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定