Skip to content

Commit 6c17d68

Browse files
authored
add sample for python v2 model (#803)
1 parent a552385 commit 6c17d68

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

samples/samples-python-v2/function_app.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Licensed under the MIT License.
33

44
import json
5+
import logging
56
import azure.functions as func
67
from azure.functions.decorators.core import DataType
78

@@ -49,3 +50,13 @@ def add_product(req: func.HttpRequest, product: func.Out[func.SqlRow]) -> func.H
4950
status_code=201,
5051
mimetype="application/json"
5152
)
53+
54+
# The function gets triggered when a change (Insert, Update, or Delete)
55+
# is made to the Products table.
56+
@app.function_name(name="ProductsTrigger")
57+
@app.generic_trigger(arg_name="products", type="sqlTrigger",
58+
TableName="Products",
59+
ConnectionStringSetting="SqlConnectionString",
60+
data_type=DataType.STRING)
61+
def products_trigger(products: str) -> None:
62+
logging.info("SQL Changes: %s", json.loads(products))

0 commit comments

Comments
 (0)