从文件流上传到 ADLS
Upload to ADLS from file stream
我正在 ADF 中进行自定义 activity,这涉及从 Azure 存储 Blob 读取多个文件,对它们进行一些处理,然后最终将生成的文件写入 Azure Data Lake Store。
最后一步是我停止的地方,因为据我所知,.NET SDK 只允许从本地文件上传。
有什么方法可以(以编程方式)将文件上传到 ADL 商店,而 而不是 来自本地文件?可以是 blob 或流。如果没有,有什么解决方法吗?
是的,可以从 Stream 上传,诀窍是先创建文件,然后将流附加到它:
string dataLakeAccount = "DLSAccountName";
var adlsFileSystemClient = new DataLakeStoreFileSystemManagementClient(credentials);
adlsFileSystemClient.FileSystem.Create(dataLakeAccount, filepath, overwrite: true);
adlsFileSystemClient.FileSystem.Append(dataLakeAccount, filepath, stream);
另见 this article。
我正在 ADF 中进行自定义 activity,这涉及从 Azure 存储 Blob 读取多个文件,对它们进行一些处理,然后最终将生成的文件写入 Azure Data Lake Store。 最后一步是我停止的地方,因为据我所知,.NET SDK 只允许从本地文件上传。
有什么方法可以(以编程方式)将文件上传到 ADL 商店,而 而不是 来自本地文件?可以是 blob 或流。如果没有,有什么解决方法吗?
是的,可以从 Stream 上传,诀窍是先创建文件,然后将流附加到它:
string dataLakeAccount = "DLSAccountName";
var adlsFileSystemClient = new DataLakeStoreFileSystemManagementClient(credentials);
adlsFileSystemClient.FileSystem.Create(dataLakeAccount, filepath, overwrite: true);
adlsFileSystemClient.FileSystem.Append(dataLakeAccount, filepath, stream);
另见 this article。