Azure / Azure/azure-functions-sql-extension
Allow stored procedures in output bindings
- Dominant language
- C#
- Stars
- 130
- Forks
- 71
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 4
Description
_chgagnon edit_ - Changing the title to reflect the root ask, being able to support stored procedures in output bindings.
Hi team,
I am following the documentation to delete a row of data from Azure SQL database, which requires creation of a stored proc which can be triggered with parameters.
https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-azure-sql-input?tabs=in-process&pivots=programming-language-javascript#http-trigger-delete-one-or-multiple-rows-javascript
The big issue I have with this is that I want to do checks prior to the stored proc executing, which I have in the index.ts (using JavaScript). I know I can run checks before adding / updating data in a table using something like this that will conditionally update the discharge table if userAuth returns true (see example below), but there doesn't seem to be something similar I can do for Stored Procs - they execute immediately?
```
import { AzureFunction, Context, HttpRequest } from "@azure/functions"
import { isUserAuth } from "../utilities"
const httpTrigger: AzureFunction = async function (context: Context, req: HttpRequest): Promise {
const userAuth = await isUserAuth(req.headers.token)
if (userAuth) context.bindings.discharge = req.body
//return
context.res = {
status: userAuth ? 200 : 403,
mimetype: "application/json",
body: userAuth ? req.body : undefined
};
};
export default httpTrigger;
```
Is this functionality that can be added, or is there a workaround to achieve the desired result?
Kind regards
Contributor guide
Research direction
Start with the Azure SQL input-binding documentation linked in the issue and the index.ts example showing conditional context.bindings assignment. Investigate how stored-procedure output bindings execute relative to the function body and whether pre-execution checks are supported. Done means establishing supported behavior or documenting a viable workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, javascript, sql, typescript
- Domain
- backend, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100