【问题标题】:Get Metadata Activity ADF V2获取元数据活动 ADF V2
【发布时间】:2018-07-20 19:48:47
【问题描述】:

谁能解释一下,ADF V2 中新引入的 Get Metadata Activity 有什么用?

实际上,docs.microsoft.com 中提供的信息不足以了解此 Activity 的用途。

【问题讨论】:

    标签: azure azure-data-factory-2


    【解决方案1】:

    Get Metadata Activity 的主要目的是:

    • 验证任何数据的元数据信息
    • 当数据准备好/可用时触发管道

    以下示例显示如何使用获取元数据活动获取文件名和修改后的时间戳从文件夹增量加载更改的文件:

                {
                    "name": "IncrementalloadfromSingleFolder",
                    "properties": {
                        "activities": [
                            {
                                "name": "GetFileList",
                                "type": "GetMetadata",
                                "policy": {
                                    "timeout": "7.00:00:00",
                                    "retry": 0,
                                    "retryIntervalInSeconds": 30,
                                    "secureOutput": false
                                },
                                "typeProperties": {
                                    "dataset": {
                                        "referenceName": "SrcLocalDir",
                                        "type": "DatasetReference"
                                    },
                                    "fieldList": [
                                        "childItems"
                                    ]
                                }
                            },
                            {
                                "name": "ForEachFile",
                                "type": "ForEach",
                                "dependsOn": [
                                    {
                                        "activity": "GetFileList",
                                        "dependencyConditions": [
                                            "Succeeded"
                                        ]
                                    }
                                ],
                                "typeProperties": {
                                    "items": {
                                        "value": "@activity('GetFileList').output.childItems",
                                        "type": "Expression"
                                    },
                                    "activities": [
                                        {
                                            "name": "GetLastModifyfromFile",
                                            "type": "GetMetadata",
                                            "policy": {
                                                "timeout": "7.00:00:00",
                                                "retry": 0,
                                                "retryIntervalInSeconds": 30,
                                                "secureOutput": false
                                            },
                                            "typeProperties": {
                                                "dataset": {
                                                    "referenceName": "SrcLocalFile",
                                                    "type": "DatasetReference"
                                                },
                                                "fieldList": [
                                                    "lastModified"
                                                ]
                                            }
                                        },
                                        {
                                            "name": "IfNewFile",
                                            "type": "IfCondition",
                                            "dependsOn": [
                                                {
                                                    "activity": "GetLastModifyfromFile",
                                                    "dependencyConditions": [
                                                        "Succeeded"
                                                    ]
                                                }
                                            ],
                                            "typeProperties": {
                                                "expression": {
                                                    "value": "@and(less(activity('GetLastModifyfromFile').output.lastModified, pipeline().parameters.current_time), greaterOrEquals(activity('GetLastModifyfromFile').output.lastModified, pipeline().parameters.last_time))",
                                                    "type": "Expression"
                                                },
                                                "ifTrueActivities": [
                                                    {
                                                        "name": "CopyNewFiles",
                                                        "type": "Copy",
                                                        "policy": {
                                                            "timeout": "7.00:00:00",
                                                            "retry": 0,
                                                            "retryIntervalInSeconds": 30,
                                                            "secureOutput": false
                                                        },
                                                        "typeProperties": {
                                                            "source": {
                                                                "type": "FileSystemSource",
                                                                "recursive": false
                                                            },
                                                            "sink": {
                                                                "type": "BlobSink"
                                                            },
                                                            "enableStaging": false,
                                                            "dataIntegrationUnits": 0
                                                        },
                                                        "inputs": [
                                                            {
                                                                "referenceName": "SrcLocalFile",
                                                                "type": "DatasetReference"
                                                            }
                                                        ],
                                                        "outputs": [
                                                            {
                                                                "referenceName": "TgtBooksBlob",
                                                                "type": "DatasetReference"
                                                            }
                                                        ]
                                                    }
                                                ]
                                            }
                                        }
                                    ]
                                }
                            }
                        ],
                        "parameters": {
                            "current_time": {
                                "type": "String",
                                "defaultValue": "2018-04-01T00:00:00Z"
                            },
                            "last_time": {
                                "type": "String",
                                "defaultValue": "2018-03-01T00:00:00Z"
                            }
                        },
                        "folder": {
                            "name": "IncrementalLoadSingleFolder"
                        }
                    },
                    "type": "Microsoft.DataFactory/factories/pipelines"
                }
    

    另请参阅最近更新的documentation

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-01
      • 1970-01-01
      • 2022-06-23
      • 1970-01-01
      • 2022-09-02
      • 1970-01-01
      相关资源
      最近更新 更多