azure-functions-python-worker icon indicating copy to clipboard operation
azure-functions-python-worker copied to clipboard

[FeatureRequest] Add binding at runtime

Open flvndh opened this issue 3 years ago • 3 comments

Input and output bindings are great abstractions for those who want to avoid using clients. Unfortunately, there are still cases where you are forced to use a client. Take for example this one:

Whenever a blob appear at /abc/{date}/{filename}.{ext} copy it to /xyz/year={year}/month={month}/day={day}/{filename}.{ext}

It requires the binding to be set at runtime which is currently not possible in Python.

An option could be to set the output path on the Out class like this:

@app.blob_trigger(
    arg_name="input_blob",
    path="abc/{date}/{filename}.{ext}",
    connection="abc",
)
@app.blob_output(
    arg_name="output_blob",
    connection="xyz",
)
def copy_blob(input_blob: func.InputStream, output_blob: func.Out[str]):
    # Logic
    output_blob.set(output, path=f"xyz/year={year}/month={month}/day={day}/{filename}.{ext}")

flvndh avatar Dec 19 '22 08:12 flvndh

@flvndh Thanks for reporting we will discuss this feature internally and update you on the inputs soon.

ramya894 avatar Dec 20 '22 08:12 ramya894

@vrdmr pls validate and comment

bhagyshricompany avatar Jan 31 '23 09:01 bhagyshricompany

@bhagyshricompany @vrdmr any news on this?

flvndh avatar May 02 '24 09:05 flvndh

This can be addressed by using SDK type bindings for blob. The BlobTrigger can define a client type, and the client type can be used to rename and upload the blob.

Please see this documentation for more information:

hallvictoria avatar Aug 08 '24 17:08 hallvictoria