I'm trying to use Sql output binding functionalities for Azure function. (local debug). Below is my current configuration. I'm using Visual Studio Code as IDE
Found Python version 3.9.0 (py).
Core Tools Version: 4.0.4736 Commit hash: N/A (64-bit)
Function Runtime Version: 4.8.1.18957
Extension bundle version: "[4.*, 5.0.0)"
functions.json :
{
"scriptFile": "__init__.py",
"bindings": [
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"post"
]
},
{
"type": "http",
"direction": "out",
"name": "$return"
},
{
"name": "transactions",
"type": "sql",
"direction": "out",
"commandText": "dbo.[table]",
"connectionStringSetting": "Driver={ODBC Driver 13 for SQL Server} etcetc."
}
]
}
init.py
import logging
import json
import azure.functions as func
def main(req: func.HttpRequest, transactions: func.Out[func.SqlRow]) -> func.HttpResponse:
logging.info("Python HTTP trigger function processed a request.")
# i'm using Vue JSON.Stringify({}) in the POST method...on client side
body = json.loads(req.get_body())
row = func.SqlRow.from_dict(body)
transactions.set(row)
return func.HttpResponse(body=json.dumps(body), status_code=201, mimetype="application/json")
Error :
[2022-09-12T17:49:13.731Z] Executed 'Functions.RegisterNewBatch' (Failed, Id=..., Duration=9ms)
[2022-09-12T17:49:13.732Z] System.Private.CoreLib: Exception while executing function:
Functions.RegisterNewBatch. Microsoft.Azure.WebJobs.Host:
Error while handling parameter _binder after function returned:
Microsoft.Data.SqlClient: The ConnectionString property has not been initialized.
Can you please help on that.