Azure / azure-functions-python-worker

Python worker for Azure Functions.
http://aka.ms/azurefunctions
MIT License
335 stars 103 forks source link

The .Read Method Returns Partial Data for Big Files #1070

Closed yarlanda closed 10 months ago

yarlanda commented 2 years ago

So I am using the Blob Trigger Functions. When the function is triggered, it reads the blob in question for further processing. Typically the files that are uploaded are 300 KB in size with 3000+ lines and are in XML format. When I use the .read() method to read the file, I only get partial data. Below is my code

def main(myblob: func.blob.InputStream):
    logging.info(f"Python blob trigger function processed blob \n"
                 f"Name: {myblob.name}\n")
    data = {myblob.read()}

    logging.info(data)

    return

Github does not allow me to upload an XML file but I can provide one if needed

Am not sure if this is a limitation or that there is another way to do it.

Thanks for your help on this

arroyc commented 1 year ago

@yarlanda did you try to download the blob first and then read it ?

yarlanda commented 1 year ago

@arroyc yes I did and the file is not partial. I tried to do it in powershell it does read the file correctly.

hallvictoria commented 11 months ago

Hi @yarlanda , are you still facing this issue?

If you haven't tried it before, I'd also recommend using the Azure Blob Storage client library for large files. Here's the doc ref: Quickstart: Azure Blob Storage client library for Python