简体   繁体   English

如何触发blob数据集作为python代码的输入?

[英]How to Trigger blob dataset as an input to a python code?

I have a requirement where I have to trigger a dataset in a blob to my python code where processing will happen and then store the processed dataset to the blob? 我有一个要求,我必须触发blob中的数据集到我的python代码,在那里处理将发生,然后将处理后的数据集存储到blob? Where should I do it? 我应该在哪里做? Any notebooks? 任何笔记本?

Azure functions dont have an option to write a Python code. Azure函数没有编写Python代码的选项。

Any help would be appreciated. 任何帮助,将不胜感激。

Depending on your design, you could create 2 processes. 根据您的设计,您可以创建2个流程。 The first one will search the data for whatever should "trigger", then notify the second processes of the "trigger" so it can read and modify the data. 第一个将搜索数据以寻找“触发”的内容,然后通知第二个进程“触发器”,以便它可以读取和修改数据。

You can work with the blob using python like the examples in azures docs. 您可以使用python使用blob,就像azures docs中的示例一样。

https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-python https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-python

More info from this post: Azure Blob - Read using Python 从这篇文章中的更多信息: Azure Blob - 使用Python阅读

from azure.storage.blob import BlockBlobService

block_blob_service = BlockBlobService(account_name='myaccount', account_key='mykey')

block_blob_service.get_blob_to_path('mycontainer', 'myblockblob', 'out-sunset.png')

You should also consider logic apps , which allows you to automate some of the tasks,and includes several actions on data sets. 您还应该考虑逻辑应用程序 ,它允许您自动执行某些任务,并包括对数据集的多个操作。 Please add more details to your question to get a more accurate answer to your request. 请在您的问题中添加更多详细信息,以便更准确地回答您的请求。

New Edit: There is support of Python 3.0 in preview for Azure functions,per the following post 新编辑:根据以下帖子 ,在Azure功能的预览中支持Python 3.0

Also, steps on where you can store your code in functions can be found here 此外,可以在此处找到可以将代码存储在函数中的步骤

Azure Functions have support Python in preview, which is based on Linux. Azure Functions在预览中支持Python,它基于Linux。 You can see the wiki page Azure Functions on Linux Preview to know about it. 您可以Azure Functions on Linux Preview查看Wiki Azure Functions on Linux Preview以了解它。

Note 注意

Python for Azure Functions is currently in preview. Python for Azure Functions目前处于预览阶段。 To receive important updates, subscribe to the Azure App Service announcements repository on GitHub. 要接收重要更新,请在GitHub上订阅Azure App Service公告存储库。

There are two documents to introduce how to develop Azure Functions using Python. 有两个文档介绍如何使用Python开发Azure函数。

  1. Create your first Python function in Azure (preview) 在Azure中创建您的第一个Python函数(预览)
  2. Azure Functions Python developer guide Azure Functions Python开发人员指南

You need to follow the documents above to use Azure CLI to run the command func new and select Blob Trigger to create an Azure Functions for Python to satisfy your requirement. 您需要按照上述文档使用Azure CLI运行命令func new并选择Blob Trigger以创建Python的Azure函数以满足您的要求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM