Reputation: 1
I have an Azure function using a Cosmos DB trigger written in Python that has both IN and OUT bindings to Cosmos DB so when a document is updated in the container I create a new document in another container. I want to create a server-side Cosmos DB trigger inside the second container that needs to be triggered when the new document is created. In the examples I have seen they show how to use the Python SDK to execute the trigger but I wanted to know if it is possible to use the bindings I already have in the function to execute the trigger rather than including the Azure Cosmos library into my function. The SDK example shows container.create_item(item, {'post_trigger_include': 'trgPreValidateToDoItemTimestamp'})
to execute the trigger, but I was hoping there was a similar option for the "set" method used in an Azure function binding to create a new document (like container.set(doc,{'post_trigger_include': 'trgPreValidateToDoItemTimestamp'})
) but that doesn't work.
Upvotes: 0
Views: 593
Reputation: 15583
Short answer is no.
The Azure Functions bindings are exposed through generic interfaces (all bindings have the same) so it does not allow for extra input parameters.
If your Function ran on .NET one alternative is to use the Binding to access the client instance and use the client instance to execute the operation instead of the Binding interface: https://learn.microsoft.com/azure/azure-functions/functions-bindings-cosmosdb-v2-input?tabs=in-process%2Cfunctionsv2&pivots=programming-language-csharp#http-trigger-get-multiple-docs-using-documentclient-c
Upvotes: 1