gpt4 book ai didi

azure - 复制时连接 Azure Blob 存储中的多个文件

转载 作者:行者123 更新时间:2023-12-03 04:22:11 31 4
gpt4 key购买 nike

我需要将一定数量的 Azure blob 从一个文件夹复制到另一个文件夹,以便下游服务可以使用它们。我一直在使用 Azure 数据工厂 (ADF) 事件“复制”来执行此操作。

要求最近发生了变化,其他服务希望将文件连接到一个文件中(文件夹中的所有文件都是具有相同布局的文本文件)。我在 ADF 复制事件中看不到任何执行此操作的选项。除了在 PowerShell 或类似工具中编写脚本之外,是否有任何方法可以使用 ADF 事件来实现此目的?

最佳答案

这绝对是可能的。您需要创建自定义ADF管道组件并实现IDotNetActivity接口(interface),更精确

    public IDictionary<string, string> Execute(IEnumerable<LinkedService> linkedServices,
IEnumerable<Dataset> datasets, Activity activity, IActivityLogger logger)
{
//PipelineConfiguration( ... ) // configure your pipeline/activity
// some code if needed
do
{
BlobResultSegment blobList;
// Get the list of input blobs from the input storage client object.
blobList = prodAzureStorageClient.ListBlobsSegmented($"{fileContainer}/{fileMask_ifAny}",
true, // Use flat blob listing
BlobListingDetails.Metadata,
null, // Max results, null = 5000
continuationToken,
null, // Blob request options
null // Operation context
);
blobs.AddRange(blobList.Results);

continuationToken = blobList.ContinuationToken;
} while (continuationToken != null);

// Read files here and concatenate them by you rules

// Upload concatenated file to Azure Blob Storage
}

问候

关于azure - 复制时连接 Azure Blob 存储中的多个文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47639430/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com