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.

Shyam V
  • 444
  • 4
  • 22

3 Answers3

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')
Nick
  • 392
  • 1
  • 5
  • 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? – Shyam V Jan 30 '19 at 18:08
  • 1
    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. – Nick Jan 30 '19 at 18:22
  • Thanks a lot Nick. – Shyam V Jan 30 '19 at 18:28
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

  • 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? – Shyam V Jan 31 '19 at 07:26
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.

Peter Pan
  • 23,476
  • 4
  • 25
  • 43