【问题标题】:Unable to delete folder using Delete activity in Azure Data factory无法使用 Azure 数据工厂中的删除活动删除文件夹
【发布时间】:2021-07-20 06:02:06
【问题描述】:

我在 blob 存储容器中有如下文件夹结构

Main
    RunID
         Folder1
                Folder 2
                         data.csv

我在数据工厂中创建了一个“删除活动”来丢弃文件夹“Main”

但是,我不断收到错误,无法使用数据源“AzureBlobStorage”执行删除活动,并且错误“远程服务器返回错误:(409) 冲突。远程服务器返回错误:(409) Conflict.'。

请提出解决此问题的解决方案。

谢谢

【问题讨论】:

  • 我尝试在我的订阅上运行它并且删除按预期工作。您能否剪切粘贴 ADF 活动 JSON 源代码,以便我们检查 ADF 设置。我只能怀疑该错误可能是由于 Blob/容器本身的某些设置造成的。您可以在link 处查看 409 错误的可能原因列表。示例是容器上的活动不可变访问策略。
  • @AnupamChand 请在下面的帖子中找到代码。
  • @AnupamChand 我用不同的订阅尝试了同样的事情,我是容器的所有者,同样的工作流程工作正常。

标签: azure azure-data-factory


【解决方案1】:

如果我尝试通过管道删除 data.csv 文件,它可以工作,但在我尝试删除文件夹时不起作用。 ADF 管道的 JSON 源代码。 我有贡献者、存储 blob 数据贡献者和存储帐户、贡献者访问权限

{
"name": "Delete files older than 30 days",
"properties": {
    "description": "Please input a folder path as the parameter for this pipeline, and the pipeline will delete files which were last modified more than 30 days ago under the particular folder path.",
    "activities": [
        {
            "name": "DeleteFiles",
            "description": "Connect to your storage account to save the log file.",
            "type": "Delete",
            "dependsOn": [],
            "policy": {
                "timeout": "7.00:00:00",
                "retry": 0,
                "retryIntervalInSeconds": 30,
                "secureOutput": false,
                "secureInput": false
            },
            "userProperties": [],
            "typeProperties": {
                "dataset": {
                    "referenceName": "BinaryDatasetForDeleteActivity",
                    "type": "DatasetReference",
                    "parameters": {
                        "FolderPath": {
                            "value": "@pipeline().parameters.SourceFolder",
                            "type": "Expression"
                        },
                        "Directory": {
                            "value": "@pipeline().parameters.SourceDirectory",
                            "type": "Expression"
                        }
                    }
                },
                "logStorageSettings": {
                    "linkedServiceName": {
                        "referenceName": "linkedService1",
                        "type": "LinkedServiceReference"
                    },
                    "path": {
                        "value": "@pipeline().parameters.LoggingPath",
                        "type": "Expression"
                    }
                },
                "enableLogging": true,
                "storeSettings": {
                    "type": "AzureBlobStorageReadSettings",
                    "recursive": true,
                    "wildcardFileName": "*"
                }
            }
        }
    ],
    "parameters": {
        "SourceFolder": {
            "type": "string",
            "defaultValue": "ildatalakefs /"
        },
        "SourceDirectory": {
            "type": "string",
            "defaultValue": "Client1 / Staging / 3f1890d4-dd35-4130-baad-a1d39972ac99 / Landing/"
        },
        "LoggingPath": {
            "type": "string",
            "defaultValue": "loggingfolder/subfolder"
        }
    },
    "annotations": [],
    "lastPublishTime": "2021-04-26T22:54:14Z"
},
"type": "Microsoft.DataFactory/factories/pipelines"

}

谢谢

【讨论】:

    【解决方案2】:

    我尝试了重现该场景但失败了,但只是为了确保我让其他人知道该解决方案确实需要实施参数化数据集,我相信你正在这样做。

    您知道要删除的文件夹中有多少 blob 吗?我认为 409 来自 delete API for storage 。 https://docs.microsoft.com/en-us/rest/api/storageservices/blob-service-error-codes

    作为测试,你能指出你只有几个 blob 的文件夹吗?由于文件夹名称是一个参数,这应该很容易测试。我敢肯定,只要文件很少,您的管道就可以正常工作。

    【讨论】:

      猜你喜欢
      • 2020-05-18
      • 1970-01-01
      • 1970-01-01
      • 2021-12-27
      • 1970-01-01
      • 2018-10-19
      • 2021-09-12
      • 2022-06-26
      • 2020-06-09
      相关资源
      最近更新 更多