question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Query parameter not resolved in SqlQuery statement

See original GitHub issue

Users want to get a query parameter to resolve in a CosmosDB input binding expression:

"SELECT * FROM c.users WHERE c.CustomerId like {Query.customerId}

But it doesn’t work per this: https://github.com/Azure/azure-functions-host/issues/2554#issuecomment-392084583

Would be good to support for consistency with other bindings

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:4
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
nzthiagocommented, Feb 27, 2020

@jeffhollan It’s been a while since first raised via https://github.com/Azure/azure-functions-host/issues/2554 but customers running into it from time to time still… Workarounds:

  • Use route paths
  • Bind to DocumentClient
  • Maintain your own static DocumentClient instance…

None are as nice as Query Params if Query Params is your project’s default though

1reaction
mentorfloatcommented, Sep 4, 2022

I was trying hard to find answers and just figure out it has bee fixed already. User can just refer to the query parameter use its key in sqlQuery as route parameter. No need “Query.” prefix.

say http://yourapi/a/b/c?myparam=myid

“sqlQuery”: “SELECT * FROM c WHERE c.id = {myparam}”

I don’t find a document tell this, or anyone come here to close the ticket, that’s terrible…

Neither SqlQuery = "SELECT * FROM c WHERE c.User = {Query.user}" nor SqlQuery = "SELECT * FROM c WHERE c.User = {user}" worked with an url of http://yourapi/a?user=myid. I’m using the latest SDK, Microsoft.Azure.WebJobs.Extensions.CosmosDB 3.0.10. Route path is still the way to go.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to ignore "cannot resolve query parameter" error in ...
Navigate over the part of the code where the error is highlighted, hit ALT + ENTER and select Inspection 'Unresolved queries and query...
Read more >
SQL: "cannot resolve query parameter" error for valid code
Relates to 1 issue (0 unresolved)​​ First we do a SELECT with one parameter and then we do an INSERT with two parameters....
Read more >
How to pass a dynamic parameter as SQL query in for SQL ...
I am trying to run dynamic queries with a parameter in Azure Data Flow but I continue to get the "Column operands are...
Read more >
[Execute SQL Task] Error: Executing the query " : "An error ...
Hi all, I use the following code in execute sql task. I set the result set to single row. Input parameter data type...
Read more >
Filter SQL query using parameters - Microsoft Fabric Community
Solved : Hi guys, I want to take values from a table in my SQL server but i want to filter the query...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found