1

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? Where should I do it? Any notebooks?

Azure functions dont have an option to write a Python code.

Any help would be appreciated.

3 Answers 3

1

Depending on your design, you could create 2 processes. 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.

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

More info from this post: Azure Blob - Read using 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')
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks Nick for the prompt answer. So this processing code in Python, where it will be written? It will be in my local python on my laptop or somewhere in Azure?
The code can run from your laptop or any computer. If you want everything to be in azure you could make an azure vm to run your code.
Thanks a lot Nick.
1

Azure Functions have support Python in preview, which is based on Linux. You can see the wiki page Azure Functions on Linux Preview to know about it.

Note

Python for Azure Functions is currently in preview. To receive important updates, subscribe to the Azure App Service announcements repository on GitHub.

There are two documents to introduce how to develop Azure Functions using Python.

  1. Create your first Python function in Azure (preview)
  2. Azure Functions Python developer guide

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.

Comments

1

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

Also, steps on where you can store your code in functions can be found here

1 Comment

Hi Adam, exact requirement is, I got a csv file in the blob, and i got a processing code in python, for that csv file. I want to run that python file, whenever a new csv is added to the blob. It should be done automatically. This is what I am trying to achieve. Main thing is where should I put this Python code in?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.