从文件流上传到ADLS [英] Upload to ADLS from file stream

查看:58
本文介绍了从文件流上传到ADLS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在ADF中进行自定义活动,其中涉及从Azure存储Blob读取多个文件,对其进行一些工作,然后最终将结果文件写入Azure Data Lake Store. 最后一步是我停止的地方,因为据我所知,.NET SDK仅允许从本地文件上传.

I am making a custom activity in ADF, which involves reading multiple files from Azure Storage Blobs, doing some work on them, and then finally writing a resulting file to the Azure Data Lake Store. Last step is where I stop, because as far as I can see, the .NET SDK only allows for uploading from a local file.

有什么方法可以(以编程方式)将文件上传到ADL Store中,而该文件不是本地文件中的 吗?可能是Blob或流.如果没有,有什么解决方法吗?

Is there any way to to (programmatically) upload a file to ADL Store, where it is not from a local file? Could be a blob or a stream. If not, any workarounds?

推荐答案

是的,可以从Stream上传,诀窍是先创建文件,然后将流附加到文件:

Yes, it's possible to upload from Stream, the trick is to create file first and then append your stream to it:

string dataLakeAccount = "DLSAccountName";
var adlsFileSystemClient = new DataLakeStoreFileSystemManagementClient(credentials);
adlsFileSystemClient.FileSystem.Create(dataLakeAccount, filepath, overwrite: true);
adlsFileSystemClient.FileSystem.Append(dataLakeAccount, filepath, stream);

另请参见 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆