如何使用天蓝色机器学习工作室“立即”从Azure Blob存储中存储的多个文件中读取数据?
我尝试使用Reader模块,它可以正常使用一个文件,它可以用于多个文件,还是我必须寻找其他解决方案?
感谢您的帮助!
答案 0 :(得分:1)
如果没有那么多blob,你可以将每个地图的多个读者添加到一个输入blob中。然后使用"数据转换"下的模块。 - > "操纵"做像"添加行"或者"加入"。
答案 1 :(得分:0)
使用大量读取不同blob的读者,然后将它们连接到MetaData编辑器。
答案 2 :(得分:0)
虽然使用多个Reader
模块的方法可行,但当输入很多或输入数量不同时,它变得非常困难。
相反,您可以使用Execute Python Script
模块直接访问blob存储。但是,如果您以前从未这样做过,那么这样做会非常痛苦。以下是问题:
azure.storage.blob
Python包未加载到Azure ML中。但是,这可以手动创建,也可以从下面的链接下载(截至2016年2月11日的正确版本)。azure.storage.blob.BlobService
的默认用法使用HTTPS,Azure ML blob存储访问目前不支持HTTPS。为此,您可以在创建BlobService期间传递protocol='http'
以强制使用HTTP:client = BlobService(STORAGE_ACCOUNT, STORAGE_KEY, protocol="http")
以下是让它运作的步骤:
azure.zip
,其中提供了所需的azure.storage.*
库:https://azuremlpackagesupport.blob.core.windows.net/python/azure.zip Execute Python Script
模块上的Zip输入,这是第3个输入。BlobService
protocol='http'
对象
可在此处找到一些示例代码:https://gist.github.com/drdarshan/92fff2a12ad9946892df
以下是使其适用于单个文件的代码。这可以扩展为通过访问容器和过滤来处理大量文件,但这取决于您的业务逻辑。
from azure.storage.blob import BlobService
def azureml_main(dataframe1 = None, dataframe2 = None):
account_name = 'mystorageaccount'
account_key='p8kSy3FACx...redacted...ebz3plQ=='
container_name = "upload"
blob_service = BlobService(account_name, account_key, protocol='http')
file = blob_service.get_blob_to_text(container_name,'myfile.txt')
# You can also get_blob_to_(bytes|file|path), if you need to do so.
# Do stuff with your file here
# Logic, logic, logic
# Execute Python Script requires that a dataframe is returned. It can be null.
# Return value must be of a sequence of pandas.DataFrame
return dataframe1,
有关限制,HTTP原因和其他说明的详细信息,请参阅Access Azure blog storage from within an Azure ML experiment