Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions samples/samples-python-v2/function_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Licensed under the MIT License.

import json
import logging
import azure.functions as func
from azure.functions.decorators.core import DataType

Expand Down Expand Up @@ -49,3 +50,13 @@ def add_product(req: func.HttpRequest, product: func.Out[func.SqlRow]) -> func.H
status_code=201,
mimetype="application/json"
)

# The function gets triggered when a change (Insert, Update, or Delete)
# is made to the Products table.
@app.function_name(name="ProductsTrigger")
@app.generic_trigger(arg_name="products", type="sqlTrigger",
TableName="Products",
ConnectionStringSetting="SqlConnectionString",
data_type=DataType.STRING)
def products_trigger(products: str) -> None:
logging.info("SQL Changes: %s", json.loads(products))