Skip to content

Commit 6180ebb

Browse files
Update functions-bindings-azure-sql-input.md
1 parent 3c199b6 commit 6180ebb

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

articles/azure-functions/functions-bindings-azure-sql-input.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,29 @@ The stored procedure `dbo.DeleteToDo` must be created on the database. In this
986986

987987
# [v2](#tab/python-v2)
988988

989-
No equivalent sample for v2 at this time.
989+
```python
990+
import logging
991+
import azure.functions as func
992+
from azure.functions.decorators.core import DataType
993+
994+
app = func.FunctionApp()
995+
996+
@app.function_name(name="DeleteToDo")
997+
@app.route(route="deletetodo/{id}")
998+
@app.sql_input(arg_name="products",
999+
command_text="DeleteToDo",
1000+
command_type="StoredProcedure",
1001+
parameters="@Id={id}",
1002+
connection_string_setting="SqlConnectionString")
1003+
def get_todo(req: func.HttpRequest, todo: func.SqlRowList) -> func.HttpResponse:
1004+
rows = list(map(lambda r: json.loads(r.to_json()), todo))
1005+
1006+
return func.HttpResponse(
1007+
json.dumps(rows),
1008+
status_code=200,
1009+
mimetype="application/json"
1010+
)
1011+
```
9901012

9911013
# [v1](#tab/python-v1)
9921014

0 commit comments

Comments
 (0)