Open zegor opened 4 years ago
@zegor Thanks for your comment. We are actively investigating and will get back to you shortly.
@zegor I have assigned this to content author for further review and update as appropriate.
To be more specific the relevant post I found is this one: https://github.com/microsoft/azure-docs/blob/master/articles/azure-functions/functions-bindings-storage-blob-input.md#python
this exact statement
logging.info(f"Python blob trigger function processed blob \n"
f"Name: {myblob.name}\n"
f"Blob Size: {myblob.length} bytes")
returns something like this
Name: None
Blob Size: None bytes
I checked the corresponding SDK[1] as well as the class mentioned, we have the corresponding attributes available and even the code which I got by the default installation from vscode
samples.
Python Version : 3.8
class InputStream(io.BufferedIOBase, abc.ABC):
"""File-like object representing an input blob."""
@abc.abstractmethod
def read(self, size=-1) -> bytes:
"""Return and read up to *size* bytes.
:param int size:
The number of bytes to read. If the argument is omitted,
``None``, or negative, data is read and returned until
EOF is reached.
:return:
Bytes read from the input stream.
"""
pass
@property
@abc.abstractmethod
def name(self) -> typing.Optional[str]:
"""The name of the blob."""
pass
@property
@abc.abstractmethod
def length(self) -> typing.Optional[int]:
"""The size of the blob in bytes."""
pass
@property
@abc.abstractmethod
def uri(self) -> typing.Optional[str]:
"""The blob's primary location URI."""
pass
I wonder how come it doesn't work.
Within the "Trigger - example" section, it states, "The string {name} in the blob trigger path samples-workitems/{name} creates a binding expression that you can use in function code to access the file name of the triggering blob. For more information, see Blob name patterns later in this article."
However, this appears to be misleading as {name} only works as it is an attribute of the InputStream class, whereas if you use other binding expressions, they do not work and throw an error when the Azure function executes (i.e. "Exception: AttributeError: 'InputStream' object has no attribute '<binding-expression>'", where <binding-expression> is the binding expression used in the function.json file.)
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.