Azure / azure-webjobs-sdk

Azure WebJobs SDK
MIT License
737 stars 358 forks source link

Difficult to handle nested tokens in IResolutionPolicy implementations #1726

Open brettsam opened 6 years ago

brettsam commented 6 years ago

PR https://github.com/Azure/azure-webjobs-sdk-extensions/pull/354 exposed some issues with our IResolutionPolicy. In short, nested tokens are really hard to handle in the same way that our other bindings handle them. We'll need to restructure how this works in order to get this working.

This directly affects Table and CosmosDB -- neither of their query bindings can handle nested property bindings today.

There's a pretty lengthy internal discussion on this that I won't paste here, but should be consulted when it comes time to do this.

piquet-h commented 5 years ago

Given this is 12 months old - what information is required to progress this?

A common pattern is responding to event grid notifications. If the data is in the EventGrid schema notification, then it's going to be under the data property, which means, by default, it's nested.

I'd really like to be able to write a function.json with code similar to "sqlQuery": "select * from transactions where transactions.atmVersion= 'strings/{data.version}'"

antempus commented 4 years ago

Jumping in here to say that this would be a much-needed improvement given that passing in multiple inputs isn't really supported; this would solve the need by allowing us to just use nested props on a complex object.

u000fsr commented 3 years ago

any updates on the ability to nested properties in cosmos sql query?

rubenmamo commented 3 years ago

Solving this would be a great help and would really simplify development of functions which access cosmos db and where you pass some sort of identifier as a header

brettsam commented 3 years ago

There's no update on this. It would require a restructuring of how our bindings pass information, and since there's a way to do this without any change, we've prioritized this lower than other issues.

The recommended solution is to pull in the Cosmos SDK and run the query in the function itself. For example, the code where we do this from our binding (which likely can be simplified if it's not a binding) is here: https://github.com/Azure/azure-webjobs-sdk-extensions/blob/dev/src/WebJobs.Extensions.CosmosDB/Bindings/CosmosDBEnumerableBuilder.cs#L27-L48

It's not as easy as using the notation above, but hopefully this isn't a blocker.