MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.2k stars 21.34k forks source link

TableInput attribute's role must be elaborated in the botnet isolated code example #122299

Open Arash-Sabet opened 4 months ago

Arash-Sabet commented 4 months ago

We need more clarity on the implication and the role of TableInput attribute in the following code snippet. Why should we have it here?

[Function("TableFunction")]
[TableOutput("OutputTable", Connection = "AzureWebJobsStorage")]
public static MyTableData Run(
    [QueueTrigger("table-items")] string input,
    [TableInput("MyTable", "<PartitionKey>", "{queueTrigger}")] MyTableData tableInput,
    FunctionContext context)
{
    var logger = context.GetLogger("TableFunction");

    logger.LogInformation($"PK={tableInput.PartitionKey}, RK={tableInput.RowKey}, Text={tableInput.Text}");

    return new MyTableData()
    {
        PartitionKey = "queue",
        RowKey = Guid.NewGuid().ToString(),
        Text = $"Output record with rowkey {input} created at {DateTime.Now}"
    };
}

Also what are the roles of "PartitionKey", {queueTrigger} in above?


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

TPavanBalaji commented 4 months ago

@Arash-Sabet Thanks for your feedback! We will investigate and update as appropriate.

Arash-Sabet commented 4 months ago

@TPavanBalaji Also the same code base example in the context of table input binding throws Json deserialization exception.

/cc @MayankBargali-MSFT