### Complete Extension Example Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/extensions.md A comprehensive example demonstrating both app-level and function-level extensions, including hooks for application loading, function invocation pre/post, and error handling. ```python from azure.functions import ( FunctionApp, AppExtensionBase, FuncExtensionBase, HttpRequest, HttpResponse ) import time import logging # App-level extension for setup/teardown class ApplicationSetupExtension(AppExtensionBase): def app_loading_hook(self, app): logging.info("Initializing application extensions") # Initialize global resources def app_loaded_hook(self, app): function_count = len(app._function_builders) logging.info(f"Application loaded with {function_count} functions") # Function-level extension for monitoring class MonitoringExtension(FuncExtensionBase): def pre_invocation_hook(self, app_script_file, function_name, args, **kwargs): args['_start_time'] = time.time() logging.info(f"Starting: {function_name}") def post_invocation_hook(self, app_script_file, function_name, args, result, **kwargs): if '_start_time' in args: duration = time.time() - args['_start_time'] logging.info(f"Completed: {function_name} in {duration:.3f}s") def invocation_error_hook(self, app_script_file, function_name, args, exc, **kwargs): logging.error(f"Failed: {function_name} - {type(exc).__name__}: {str(exc)}") # Create function app with extensions app = FunctionApp() @app.route(route="hello") def hello_function(req: HttpRequest) -> HttpResponse: return HttpResponse("Hello, World!") @app.route(route="slow") def slow_function(req: HttpRequest) -> HttpResponse: time.sleep(1) return HttpResponse("Done") @app.route(route="error") def error_function(req: HttpRequest) -> HttpResponse: raise Exception("Intentional error for testing") ``` -------------------------------- ### Install Release Tools Source: https://github.com/azure/azure-functions-python-library/wiki/Release-Instructions Installs Twine for PyPI uploads and Wheel for building distribution packages. These are essential prerequisites for the release process. ```shell pip install twine wheel ``` -------------------------------- ### Connection String Settings Example Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/triggers-bindings.md Shows how to define connection string settings in local.settings.json for various Azure services. ```json { "Values": { "AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=myaccount;...", "ServiceBusConnection": "Endpoint=sb://myns.servicebus.windows.net/;SharedAccessKeyName=...", "CosmosConnection": "AccountEndpoint=https://myaccount.documents.azure.com/;AccountKey=..." } } ``` -------------------------------- ### Plain Text HttpResponse Example Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/http-classes.md Illustrates creating a simple HTTP response with plain text content. ```python return HttpResponse("Hello, World!") ``` -------------------------------- ### AsgiFunctionApp Example with FastAPI Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/http-classes.md Shows how to wrap a FastAPI ASGI application using AsgiFunctionApp for Azure Functions. This integrates FastAPI applications seamlessly. ```python from fastapi import FastAPI from azure.functions import AsgiFunctionApp # Create FastAPI app fastapi_app = FastAPI() @fastapi_app.get('/api/items') async def list_items(): return [{'id': 1, 'name': 'Item 1'}] # Create function app wrapper app = AsgiFunctionApp(fastapi_app) # Add additional functions @app.route(route="status") def status(req): return "Running" ``` -------------------------------- ### Binary HttpResponse Example Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/http-classes.md Shows how to return binary data in an HTTP response, setting the appropriate mimetype for binary streams. ```python return HttpResponse( body=binary_data, status_code=200, mimetype="application/octet-stream" ) ``` -------------------------------- ### Binding Composition Example Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/triggers-bindings.md Demonstrates composing multiple bindings (Service Bus trigger, Cosmos DB output, Blob output) on a single function. ```python @app.service_bus_topic_trigger( arg_name="input_msg", connection="ServiceBusConnection", topic_name="orders", subscription_name="processor" ) @app.cosmos_db_output( arg_name="processed", database_name="mydb", collection_name="processed_orders", connection_string_setting="CosmosConnection" ) @app.blob_output( arg_name="archive", path="archive/{id}", connection="AzureWebJobsStorage" ) def process_order(input_msg: ServiceBusMessage, processed, archive): order = input_msg.get_json() # Write to Cosmos DB processed.set(order) # Write to Blob archive.set(json.dumps(order)) ``` -------------------------------- ### WsgiFunctionApp Example with Flask Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/http-classes.md Demonstrates how to wrap a Flask WSGI application using WsgiFunctionApp for Azure Functions. This allows integrating existing Flask applications. ```python from flask import Flask from azure.functions import WsgiFunctionApp # Create Flask app flask_app = Flask(__name__) @flask_app.route('/api/hello') def hello(): return {'message': 'Hello'} # Create function app wrapper app = WsgiFunctionApp(flask_app) # Additional functions can be added to the app @app.route(route="health") def health_check(req): return "OK" ``` -------------------------------- ### Custom Headers HttpResponse Example Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/http-classes.md Provides an example of setting custom HTTP headers and standard headers like 'Cache-Control' in an HttpResponse. ```python return HttpResponse( body="OK", headers={ "X-Custom-Header": "value", "Cache-Control": "no-cache" } ) ``` -------------------------------- ### App Loading Hook Example Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/extensions.md Implement the app_loading_hook to perform actions when the function app is being loaded, such as initializing logging or metrics. ```python from azure.functions import AppExtensionBase class LoggingExtension(AppExtensionBase): def app_loading_hook(self, app): print(f"App loading: {app.app_script_file}") # Initialize logging, metrics, etc. ``` -------------------------------- ### Create a Blueprint Instance Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/blueprint.md Instantiates a Blueprint object. This is the starting point for defining a group of related functions. ```python from azure.functions.decorators import Blueprint # Create a blueprint for user-related functions user_blueprint = Blueprint() ``` -------------------------------- ### Function Loading Hook Example Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/extensions.md Implement the function_loading_hook to perform actions when an individual function is being loaded, before its metadata is finalized. This can be used for validation or setup specific to a function. ```python class FunctionValidationExtension(AppExtensionBase): def function_loading_hook(self, function_instance): func_name = function_instance.get_function_name() print(f"Loading function: {func_name}") ``` -------------------------------- ### Example local.settings.json Configuration Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/configuration.md This JSON snippet shows a typical configuration for local development using local.settings.json. It includes essential settings like Azure Storage and Service Bus connection strings, and the worker runtime. ```json { "IsEncrypted": false, "Values": { "AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=...", "ServiceBusConnection": "Endpoint=sb://myns.servicebus.windows.net/;SharedAccessKeyName=...", "FUNCTIONS_WORKER_RUNTIME": "python" } } ``` -------------------------------- ### JSON HttpResponse Example Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/http-classes.md Shows how to construct an HTTP response with a JSON body, specifying the status code and mimetype. ```python import json data = {"message": "success", "id": 123} return HttpResponse( body=json.dumps(data), status_code=200, mimetype="application/json" ) ``` -------------------------------- ### HTTP Trigger Function Example Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/types.md An example of an HTTP-triggered function demonstrating how to access request data like JSON body, route parameters, and query parameters. ```python @app.route(route="items") def create_item(req: HttpRequest): data = req.get_json() item_id = req.route_params.get('id') name = req.params.get('name', 'default') return f"Created {name} with id {item_id}" ``` -------------------------------- ### HTTP Trigger with String Method Values Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/configuration.md Alternatively, specify HTTP methods as strings in the methods list for an HTTP trigger route. This example accepts GET, POST, and DELETE. ```python @app.route(route="api", methods=["GET", "POST", "DELETE"]) def api_endpoint(req): pass ``` -------------------------------- ### Error HttpResponse Example Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/http-classes.md Demonstrates creating an HTTP error response, typically used for indicating resource not found or other client errors. ```python return HttpResponse( body='{"error": "Not found"}', status_code=404, mimetype="application/json" ) ``` -------------------------------- ### Example HttpRequest Usage Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/http-classes.md Demonstrates how to access request data like JSON body, query parameters, route parameters, and headers within an Azure Function. ```python from azure.functions import HttpRequest, HttpResponse @app.route(route="api/users") def create_user(req: HttpRequest) -> HttpResponse: # Get JSON body user_data = req.get_json() # Get query parameters format = req.params.get('format', 'json') # Get route parameters (if using {id}) user_id = req.route_params.get('id') # Get headers auth_header = req.headers.get('authorization') return HttpResponse(f"User created: {user_data['name']}") ``` -------------------------------- ### Simple HTTP Handler Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/README.md Handles incoming HTTP requests and returns a simple 'Hello, World!' response. This is a basic example for setting up an HTTP-triggered function. ```python from azure.functions import FunctionApp, HttpRequest, HttpResponse app = FunctionApp() @app.route(route="hello") def hello_world(req: HttpRequest) -> HttpResponse: return HttpResponse("Hello, World!", status_code=200) ``` -------------------------------- ### Compose Function App from Team-Contributed Blueprints Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/blueprint.md Example of merging blueprints contributed by different teams (Team A and Team B) into a main FunctionApp. ```python team_a_functions = Blueprint() # Team A's contributions team_b_functions = Blueprint() # Team B's contributions app = FunctionApp() app._function_builders.extend(team_a_functions._function_builders) app._function_builders.extend(team_b_functions._function_builders) ``` -------------------------------- ### Distributed Tracing Extension Example Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/extensions.md Implement a function-level extension to add distributed tracing capabilities. This involves initializing trace IDs in pre_invocation_hook and logging traces in post_invocation_hook. ```python class DistributedTracingExtension(FuncExtensionBase): def pre_invocation_hook(self, app_script_file, function_name, args, **kwargs): # Initialize trace ID args['trace_id'] = generate_trace_id() def post_invocation_hook(self, app_script_file, function_name, args, result, **kwargs): # Log trace log_invocation_trace(args['trace_id'], function_name) ``` -------------------------------- ### Post Invocation Hook Example Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/extensions.md Implement the post_invocation_hook to perform actions after a function completes successfully. This can include logging the result or recording metrics. ```python class PerformanceExtension(FuncExtensionBase): def post_invocation_hook(self, app_script_file, function_name, args, result, **kwargs): print(f"{function_name} returned: {result}") # Log invocation duration, record metrics, etc. ``` -------------------------------- ### Example: Setting a Custom Function Name Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/function-app.md Demonstrates how to use the function_name decorator to assign a custom name to an Azure Function, alongside a route decorator. This is useful for managing function names explicitly. ```python @app.function_name(name="MyCustomFunctionName") @app.route(route="trigger") def my_function(req): return "OK" ``` -------------------------------- ### Integrate FastAPI with Azure Functions using ASGI Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/README.md This snippet demonstrates how to wrap a FastAPI application to be used with Azure Functions via the AsgiFunctionApp class. It shows a basic GET endpoint for users. ```python from fastapi import FastAPI from azure.functions import AsgiFunctionApp fastapi_app = FastAPI() @fastapi_app.get("/api/users") async def get_users(): return {"users": []} app = AsgiFunctionApp(fastapi_app) ``` -------------------------------- ### App Loaded Hook Example Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/extensions.md Use the app_loaded_hook to execute code after the function app has been fully loaded and all functions are indexed. This is useful for registering metrics or validating configuration. ```python class MetricsExtension(AppExtensionBase): def app_loaded_hook(self, app): function_count = len(app._function_builders) print(f"App loaded with {function_count} functions") # Register metrics, validate config, etc. ``` -------------------------------- ### Get Binding Information by Name Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/binding-registry.md Fetches details for a specific binding type using its registered name. Returns None if the binding is not found. ```python registry = get_binding_registry() # Get HTTP trigger binding http_info = registry.get_binding_by_name('httpTrigger') if http_info: print(f"HTTP trigger found: {http_info}") # Get queue binding queue_info = registry.get_binding_by_name('queue') ``` -------------------------------- ### Pre-Invocation Hook Example Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/extensions.md Implement the pre_invocation_hook to execute code just before a function is invoked and after its parameters have been bound. This is suitable for logging, setting request IDs, or performing pre-invocation checks. ```python from azure.functions import FuncExtensionBase class InvocationLoggingExtension(FuncExtensionBase): def pre_invocation_hook(self, app_script_file, function_name, args, **kwargs): print(f"Invoking {function_name} with args: {list(args.keys())}") # Log invocation start, set request ID, etc. ``` -------------------------------- ### Blueprint Constructor and Usage Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/blueprint.md Demonstrates how to create a Blueprint instance and use its decorators to define routes for functions. ```APIDOC ## Blueprint() ### Description Creates a new Blueprint instance with no parameters. ### Constructor ```python Blueprint() ``` ### Example ```python from azure.functions.decorators import Blueprint # Create a blueprint for user-related functions user_blueprint = Blueprint() @user_blueprint.route(route="users") def list_users(req): return "User list" @user_blueprint.route(route="users/{id}") def get_user(req): user_id = req.route_params['id'] return f"User {user_id}" ``` ``` -------------------------------- ### HttpMethod GET and POST for HTTP Trigger Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/configuration.md Configure an HTTP trigger to accept GET and POST requests using HttpMethod enum. The route is defined as 'items'. ```python from azure.functions.decorators import HttpMethod @app.route( route="items", methods=[HttpMethod.GET, HttpMethod.POST] ) def handle_items(req): if req.method == "GET": return "List items" else: return "Create item" ``` -------------------------------- ### AsgiMiddleware Constructor Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/http-classes.md Information on initializing the AsgiMiddleware to wrap an ASGI application. ```APIDOC ## AsgiMiddleware Constructor ### Description Wraps an ASGI application to enable it to run within an Azure Function's HTTP trigger, supporting asynchronous applications. ### Constructor `AsgiMiddleware(app: Callable)` - **app** (`Callable`) - An ASGI application (e.g., Starlette, FastAPI app). ``` -------------------------------- ### HttpRequest Common Properties Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/http-classes.md Access common properties of an HttpRequest object to get details about the incoming request. ```python request.method # str: "GET", "POST", etc. request.url # str: Full URL with query string request.headers # Mapping[str, str]: HTTP headers (case-insensitive) request.params # Mapping[str, str]: Query string parameters request.route_params # Mapping[str, str]: Route template parameters ``` -------------------------------- ### Register Blueprint by Inheriting from Blueprint Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/blueprint.md Demonstrates how to create a FunctionApp by inheriting from a Blueprint, effectively registering all functions defined within the blueprint. ```python from azure.functions.decorators import FunctionApp, Blueprint # Define functions in a blueprint user_blueprint = Blueprint() @user_blueprint.route(route="users") def list_users(req): return "Users" # Create app and register app = FunctionApp() # You can access the internal builders and rebuild into app for builder in user_blueprint._function_builders: app._function_builders.append(builder) ``` -------------------------------- ### WsgiMiddleware Constructor Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/http-classes.md Information on initializing the WsgiMiddleware to wrap a WSGI application. ```APIDOC ## WsgiMiddleware Constructor ### Description Wraps a WSGI application to enable it to run within an Azure Function's HTTP trigger. ### Constructor `WsgiMiddleware(app: Callable)` - **app** (`Callable`) - A WSGI application (e.g., Flask, Django app). ``` -------------------------------- ### Create Blueprints for Shared Integration Patterns Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/blueprint.md Shows how to define Blueprints for common integration patterns, such as those involving Service Bus, storage, or databases. ```python service_bus_patterns = Blueprint() storage_patterns = Blueprint() database_patterns = Blueprint() ``` -------------------------------- ### Build and Upload to PyPI Source: https://github.com/azure/azure-functions-python-library/wiki/Release-Instructions Builds source and wheel distributions and uploads them to the official PyPI repository. Ensure `dist/*` is cleared before building. ```shell rm dist/* python setup.py sdist bdist_wheel twine upload dist/* ``` -------------------------------- ### Handling Route and Query Parameters Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/http-classes.md Demonstrates how to extract route parameters from the URL path and query string parameters from the request. It also shows how to construct an HTTP response. ```APIDOC ## GET /items/{category}/{id} ### Description Retrieves an item based on its category and ID, with optional query parameters for format and detail level. ### Method GET ### Endpoint /items/{category}/{id} ### Parameters #### Path Parameters - **category** (string) - Required - The category of the item. - **id** (string) - Required - The ID of the item. #### Query Parameters - **format** (string) - Optional - The desired format for the response (defaults to 'json'). - **detailed** (boolean) - Optional - Whether to return detailed information (defaults to 'false'). ### Response #### Success Response (200) - **body** (string) - A message indicating the extracted category, ID, and format. #### Response Example ``` Category: electronics, ID: 123, Format: json ``` ``` -------------------------------- ### Organize API Endpoints by Version using Blueprints Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/blueprint.md Demonstrates how to create separate blueprints for different API versions (v1 and v2) to manage endpoints distinctly. ```python api_v1 = Blueprint() api_v2 = Blueprint() @api_v1.route(route="v1/users") def v1_users(req): pass @api_v2.route(route="v2/users") def v2_users(req): pass ``` -------------------------------- ### Group Functions by Business Domain using Blueprints Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/blueprint.md Illustrates using Blueprints to group functions related to specific business domains like users, products, and orders. ```python users_service = Blueprint() products_service = Blueprint() orders_service = Blueprint() ``` -------------------------------- ### Organize FunctionApp with Multiple Blueprints Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/blueprint.md Shows how to use multiple Blueprints for different sets of operations (e.g., users, products) and then merge their functions into a single FunctionApp. ```python from azure.functions.decorators import FunctionApp, Blueprint # User operations users = Blueprint() @users.route(route="users/{id}") def get_user(req): return f"User {req.route_params['id']}" @users.queue_output(arg_name="msg", queue_name="users", connection="AzureWebJobsStorage") def create_user(req, msg): msg.set(req.get_json()) return "User created" # Product operations products = Blueprint() @products.route(route="products") def list_products(req): return "Products list" # Main app app = FunctionApp() # Merge blueprints (via internal structure) for bp in [users, products]: app._function_builders.extend(bp._function_builders) ``` -------------------------------- ### Parameterizing Paths with Route Parameters Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/triggers-bindings.md Illustrates using route parameters (e.g., '{id}') in blob output paths to dynamically set the destination path. ```python @app.route(route="process/{id}") @app.blob_output(arg_name="output", path="results/{id}", connection="AzureWebJobsStorage") def process_request(req, output): item_id = req.route_params['id'] output.set(f"Processed {item_id}") ``` -------------------------------- ### Build and Upload to TestPyPI Source: https://github.com/azure/azure-functions-python-library/wiki/Release-Instructions Builds source and wheel distributions and uploads them to the TestPyPI repository. Ensure `dist/*` is cleared before building. ```shell rm dist/* python setup.py sdist bdist_wheel twine upload --repository-url https://test.pypi.org/legacy/ dist/* ``` -------------------------------- ### Get Default Callback for json.dumps Source: https://github.com/azure/azure-functions-python-library/blob/dev/spec-functions-sdk-df-serialization.md Returns the default callback for json.dumps, useful for sites that construct their own json.dumps invocation. This function is intended for use with OrchestratorState.to_json_string. ```python def _get_serialize_default() -> Callable: """Return the ``default`` callback for ``json.dumps``. For use in call sites that build their own ``json.dumps`` invocation (e.g. ``OrchestratorState.to_json_string``). """ return _serialize_custom_object ``` -------------------------------- ### Handle Function Extension Exceptions Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/extensions.md Demonstrates how to catch `FunctionExtensionException` which wraps exceptions raised by extension hooks during app initialization. ```python from azure.functions import FunctionExtensionException try: app_instance.load_functions() except FunctionExtensionException as e: print(f"Extension error: {e}") # Handle extension initialization failure ``` -------------------------------- ### Get All Registered Bindings Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/binding-registry.md Retrieves a list of all binding information objects currently registered in the binding registry. Useful for introspection or discovering available bindings. ```python registry = get_binding_registry() bindings = registry.get_all_bindings() for binding_info in bindings: print(f"Binding: {binding_info.name}") ``` -------------------------------- ### Invocation Error Hook Example Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/extensions.md Implement the invocation_error_hook to handle exceptions raised by a function. This allows for logging errors, sending alerts, or updating status pages. ```python class ErrorHandlingExtension(FuncExtensionBase): def invocation_error_hook(self, app_script_file, function_name, args, exc, **kwargs): print(f"Error in {function_name}: {str(exc)}") # Send alert, record error metrics, update status page, etc. ``` -------------------------------- ### Usage of WsgiMiddleware with Flask Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/http-classes.md Demonstrates how to wrap a Flask WSGI application using WsgiMiddleware to run it within an Azure Function HTTP trigger. ```python from flask import Flask from azure.functions import FunctionApp, WsgiMiddleware # Create Flask app flask_app = Flask(__name__) @flask_app.route('/api/users') def get_users(): return {'users': []} # Wrap in function app function_app = FunctionApp() @function_app.route(route="{*route}") def main(req): return WsgiMiddleware(flask_app).handle(req) ``` -------------------------------- ### Function Loaded Hook Example Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/extensions.md The function_loaded_hook is called after a function has been fully loaded with all its bindings. Use this to register functions in external systems or perform post-load checks. ```python class FunctionRegistryExtension(AppExtensionBase): def function_loaded_hook(self, function_instance): trigger = function_instance.get_trigger() print(f"Loaded function with trigger type: {trigger.type if trigger else None}") # Register in external systems ``` -------------------------------- ### Blueprint Available Methods Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/blueprint.md Lists the trigger, binding, and settings methods available on the Blueprint class, which are identical to those on the FunctionApp class. ```APIDOC ## Available Methods Blueprint provides the same decorator methods as `FunctionApp`: ### Trigger Methods - `route()` - HTTP trigger - `timer_trigger()` / `schedule()` - Timer trigger - `queue_trigger()` - Queue trigger - `service_bus_queue_trigger()` - Service Bus queue trigger - `service_bus_topic_trigger()` - Service Bus topic trigger - `blob_trigger()` - Blob storage trigger - `event_hub_trigger()` - Event Hub trigger - `cosmos_db_trigger()` - Cosmos DB change feed - `kafka_trigger()` - Kafka messages - `sql_trigger()` - SQL table changes - `mysql_trigger()` - MySQL table changes - `generic_trigger()` - Custom trigger type - `connector_trigger()` - Connector trigger - `mcp_tool_trigger()` - MCP tool trigger - `warm_up_trigger()` - Warmup trigger - `orchestration_trigger()` - Durable orchestrator (requires azure-functions-durable) - `entity_trigger()` - Durable entity (requires azure-functions-durable) - `activity_trigger()` - Durable activity (requires azure-functions-durable) ### Binding Methods - `blob_input()` / `blob_output()` - Blob storage - `queue_output()` - Queue output - `service_bus_queue_output()` / `service_bus_topic_output()` - Service Bus - `event_hub_output()` - Event Hub - `cosmos_db_input()` / `cosmos_db_output()` - Cosmos DB - `sql_input()` / `sql_output()` - SQL Database - `mysql_input()` / `mysql_output()` - MySQL - `table_input()` / `table_output()` - Table storage - `kafka_output()` - Kafka - `generic_input_binding()` / `generic_output_binding()` - Custom binding - `durable_client_input()` - Durable client (requires azure-functions-durable) ### Settings Methods - `function_name()` - Override function name - `http_type()` - Set HTTP type (function, asgi, wsgi) ``` -------------------------------- ### WsgiFunctionApp Constructor Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/http-classes.md Initializes a WsgiFunctionApp to wrap a WSGI application for Azure Functions. It allows configuration of authorization level and the generated function name. ```APIDOC ## WsgiFunctionApp Constructor ### Description Initializes a WsgiFunctionApp to wrap a WSGI application for Azure Functions. It allows configuration of authorization level and the generated function name. ### Parameters #### Parameters - **app** (Callable) - Required - WSGI application instance. - **http_auth_level** (Union[AuthLevel, str]) - Optional - HTTP authorization level for the app. Defaults to `AuthLevel.FUNCTION`. - **function_name** (str) - Optional - Name of the generated function. Defaults to `'http_app_func'`. ``` -------------------------------- ### Read Blob Content Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/types.md The InputStream type provides a file-like interface for reading blob content. Use the read() method to get the blob's content as bytes. ```python @app.blob_trigger(arg_name="blob", path="samples/{name}", connection="AzureWebJobsStorage") def process_blob(blob: InputStream): content = blob.read() print(f"Blob {blob.name}: {len(content)} bytes") ``` -------------------------------- ### Get Global Binding Registry Instance Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/binding-registry.md Retrieves the singleton instance of the BindingRegistry. Use this to access and query all available binding types within the Azure Functions worker. ```python from azure.functions import get_binding_registry registry = get_binding_registry() # Query available bindings http_binding = registry.get_binding_by_name('httpTrigger') queue_binding = registry.get_binding_by_name('queueTrigger') print(f"Available bindings: {len(registry.get_all_bindings())}") ``` -------------------------------- ### AsgiMiddleware.handle_async() Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/http-classes.md Handles an incoming HTTP request asynchronously using an ASGI application. ```APIDOC ## AsgiMiddleware.handle_async() ### Description Handles an HTTP request asynchronously by passing it to the wrapped ASGI application. ### Method Signature `async def handle_async(req: HttpRequest, context: Context) -> HttpResponse` ### Parameters - **req** (`HttpRequest`) - The incoming HTTP request object. - **context** (`Context`) - The function invocation context. ### Returns - `HttpResponse` - The response generated by the ASGI application. ``` -------------------------------- ### Process ServiceBusMessage in Azure Functions Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/types.md Example of processing a ServiceBusMessage triggered by a Service Bus queue. It demonstrates how to retrieve JSON data from the message body and access correlation ID. ```python from azure.functions import ServiceBusMessage @app.service_bus_queue_trigger( arg_name="msg", connection="ServiceBusConnection", queue_name="orders" ) def process_order(msg: ServiceBusMessage): order = msg.get_json() print(f"Order {order['id']} from {msg.correlation_id}") ``` -------------------------------- ### sql_input() Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/triggers-bindings.md Queries data from a SQL Database. Requires a command text and connection string setting, with optional parameters for more specific queries. ```APIDOC ## sql_input() ### Description Queries data from a SQL Database. ### Method `sql_input` ### Parameters - **arg_name** (str) - Required - The name of the argument. - **command_text** (str) - Required - The SQL command text to execute. - **connection_string_setting** (str) - Required - The name of the app setting for the SQL connection string. - **parameters** (Optional[str]) - Optional - Parameters for the SQL command. - **data_type** (Optional[Union[DataType, str]]) - Optional - The data type of the returned rows. ### Returns - `Callable` - A callable that returns the queried data. ``` -------------------------------- ### Query Available Triggers Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/binding-registry.md This snippet demonstrates how to retrieve all available bindings from the registry and filter them to find triggers. It then prints the names of all supported triggers. ```python from azure.functions import get_binding_registry registry = get_binding_registry() # Find all available triggers triggers = [b for b in registry.get_all_bindings() if 'Trigger' in b.name] print("Available triggers:") for trigger in triggers: print(f" - {trigger.name}") ``` -------------------------------- ### AsgiMiddleware Constructor Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/http-classes.md Defines the constructor for AsgiMiddleware, which accepts an ASGI application callable. ```python AsgiMiddleware(app: Callable) ``` -------------------------------- ### PromptInvocationContext Constructor Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/types.md Initializes a PromptInvocationContext object. Accepts either a dictionary or a JSON string as input data for the context. ```python PromptInvocationContext(data: Union[dict, str]) ``` -------------------------------- ### Create FunctionApp Instance Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/function-app.md Instantiate the FunctionApp class, optionally setting a default HTTP authorization level. This is the first step in defining your function app. ```python from azure.functions.decorators import FunctionApp, AuthLevel app = FunctionApp(http_auth_level=AuthLevel.ANONYMOUS) @app.route(route="hello") def hello_http(req): return "Hello, World!" ``` -------------------------------- ### HttpResponse Constructor Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/http-classes.md Details on how to construct an HttpResponse object to send back to the client. ```APIDOC ## HttpResponse Constructor ### Description Initialize an HttpResponse object to define the response sent to the client. ### Constructor `HttpResponse( body: Optional[Union[str, bytes]] = None, status_code: Optional[Union[http.HTTPStatus, int]] = None, headers: Optional[Mapping[str, str]] = None, mimetype: Optional[str] = None, charset: Optional[str] = None )` - **body** (Optional[Union[str, bytes]]) - The response body content. - **status_code** (Optional[Union[http.HTTPStatus, int]]) - The HTTP status code (e.g., 200, 404). - **headers** (Optional[Mapping[str, str]]) - Custom response headers. - **mimetype** (Optional[str]) - The MIME type of the response body. - **charset** (Optional[str]) - The character set of the response body. ``` -------------------------------- ### Registering Blueprints with FunctionApp Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/blueprint.md Illustrates two methods for integrating Blueprints into a FunctionApp: by inheriting from Blueprint or by manually merging function builders from multiple blueprints. ```APIDOC ## Registering Blueprints with FunctionApp Blueprints are not directly registered via decorators. Instead, they are typically composed into a `FunctionApp` through inheritance or manual function registration. ### Method 1: Inheriting from Blueprint Create a function app class that extends Blueprint: ```python from azure.functions.decorators import FunctionApp, Blueprint # Define functions in a blueprint user_blueprint = Blueprint() @user_blueprint.route(route="users") def list_users(req): return "Users" # Create app and register app = FunctionApp() # You can access the internal builders and rebuild into app for builder in user_blueprint._function_builders: app._function_builders.append(builder) ``` ### Method 2: Organizing with Multiple Blueprints ```python from azure.functions.decorators import FunctionApp, Blueprint # User operations users = Blueprint() @users.route(route="users/{id}") def get_user(req): return f"User {req.route_params['id']}" @users.queue_output(arg_name="msg", queue_name="users", connection="AzureWebJobsStorage") def create_user(req, msg): msg.set(req.get_json()) return "User created" # Product operations products = Blueprint() @products.route(route="products") def list_products(req): return "Products list" # Main app app = FunctionApp() # Merge blueprints (via internal structure) for bp in [users, products]: app._function_builders.extend(bp._function_builders) ``` ``` -------------------------------- ### AsgiFunctionApp Constructor Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/http-classes.md Initializes an AsgiFunctionApp to wrap an ASGI application for Azure Functions. It allows configuration of authorization level and the generated function name. ```APIDOC ## AsgiFunctionApp Constructor ### Description Initializes an AsgiFunctionApp to wrap an ASGI application for Azure Functions. It allows configuration of authorization level and the generated function name. ### Parameters #### Parameters - **app** (Callable) - Required - ASGI application instance. - **http_auth_level** (Union[AuthLevel, str]) - Optional - HTTP authorization level for the app. Defaults to `AuthLevel.FUNCTION`. - **function_name** (str) - Optional - Name of the generated function. Defaults to `'http_app_func'`. ``` -------------------------------- ### MySQL Output Binding Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/triggers-bindings.md Use this decorator to send dictionaries or lists of dictionaries to a MySQL Database. Requires a command text and a connection string setting. ```python @app.mysql_output( arg_name: str, command_text: str, parameters: Optional[str] = None, connection_string_setting: str, data_type: Optional[Union[DataType, str]] = None, **kwargs ) -> Callable ``` -------------------------------- ### warm_up_trigger Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/triggers-bindings.md Warmup trigger - fires during function app startup. ```APIDOC ## warm_up_trigger() ### Description Fires during the function app startup process to allow for pre-warming. ### Method `@app.warm_up_trigger(...)` ### Parameters - **arg_name** (str) - Required - The name of the argument that will hold the warmup context. - **data_type** (Optional[Union[DataType, str]]) - Optional - The data type of the warmup context. ### Input Type `WarmUpContext` ### Reference https://aka.ms/azure-function-binding-warmup ``` -------------------------------- ### SQL Output Binding Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/triggers-bindings.md Use this decorator to send dictionaries or lists of dictionaries to a SQL Database. Requires a command text and a connection string setting. ```python @app.sql_output( arg_name: str, command_text: str, parameters: Optional[str] = None, connection_string_setting: str, data_type: Optional[Union[DataType, str]] = None, **kwargs ) -> Callable ``` -------------------------------- ### Implement Performance Monitoring Extension Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/extensions.md This extension hooks into function invocations to record and send performance metrics like duration. It requires a `send_metric` function to be available. ```python class PerformanceMonitoringExtension(FuncExtensionBase): def pre_invocation_hook(self, app_script_file, function_name, args, **kwargs): args['start_time'] = time.time() def post_invocation_hook(self, app_script_file, function_name, args, result, **kwargs): duration = time.time() - args.get('start_time', time.time()) send_metric(f"function.duration.{function_name}", duration) ``` -------------------------------- ### mysql_input() Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/triggers-bindings.md Queries data from a MySQL Database. Similar to sql_input, it requires command text and connection string, with support for parameters. ```APIDOC ## mysql_input() ### Description Queries data from a MySQL Database. ### Method `mysql_input` ### Parameters - **arg_name** (str) - Required - The name of the argument. - **command_text** (str) - Required - The MySQL command text to execute. - **connection_string_setting** (str) - Required - The name of the app setting for the MySQL connection string. - **parameters** (Optional[str]) - Optional - Parameters for the MySQL command. - **data_type** (Optional[Union[DataType, str]]) - Optional - The data type of the returned rows. ### Returns - `Callable` - A callable that returns the queried data. ``` -------------------------------- ### AsgiMiddleware Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/types.md A wrapper for ASGI applications designed to be used within Azure Functions HTTP triggers. ```APIDOC ## Class: AsgiMiddleware ### Description Wrapper for ASGI applications in HTTP functions. ### Source `azure.functions._http_asgi.AsgiMiddleware` ``` -------------------------------- ### WsgiMiddleware Constructor Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/http-classes.md Defines the constructor for WsgiMiddleware, which takes a WSGI application callable as its argument. ```python WsgiMiddleware(app: Callable) ``` -------------------------------- ### Batching Messages with Cardinality Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/triggers-bindings.md Demonstrates receiving messages in batches from a queue trigger by setting cardinality to Cardinality.MANY. ```python @app.queue_trigger( arg_name="messages", queue_name="items", connection="AzureWebJobsStorage", cardinality=Cardinality.MANY ) def process_batch(messages): for msg in messages: print(msg.get_body()) ``` -------------------------------- ### Usage of WsgiMiddleware with Django Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/http-classes.md Shows the pattern for integrating a Django WSGI application with Azure Functions using WsgiMiddleware. ```python from django.conf import urls from azure.functions import FunctionApp, WsgiMiddleware # Configure Django django_app = # ... your Django WSGI application function_app = FunctionApp() @function_app.route(route="{*route}") def main(req): return WsgiMiddleware(django_app).handle(req) ``` -------------------------------- ### WsgiMiddleware Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/types.md A wrapper for WSGI applications designed to be used within Azure Functions HTTP triggers. ```APIDOC ## Class: WsgiMiddleware ### Description Wrapper for WSGI applications in HTTP functions. ### Source `azure.functions._http_wsgi.WsgiMiddleware` ``` -------------------------------- ### AsgiMiddleware handle_async Method Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/http-classes.md Details the asynchronous method for handling HTTP requests with an ASGI application within Azure Functions. ```python async def handle_async( req: HttpRequest, context: Context ) -> HttpResponse ``` -------------------------------- ### FunctionApp Constructor Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/function-app.md Initializes a new FunctionApp instance. You can set a default HTTP authorization level for all HTTP trigger functions within this app. ```APIDOC ## FunctionApp Constructor ### Description Creates a new FunctionApp instance with an optional default HTTP authorization level. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **http_auth_level** (`Union[AuthLevel, str]`) - Optional - Default: `AuthLevel.FUNCTION` - Default HTTP authorization level applied to HTTP trigger functions without explicit auth_level. Can be a string name or AuthLevel enum value. ### Request Example ```python from azure.functions.decorators import FunctionApp, AuthLevel app = FunctionApp(http_auth_level=AuthLevel.ANONYMOUS) @app.route(route="hello") def hello_http(req): return "Hello, World!" ``` ### Response None ### Error Handling - `ValueError`: Raised if auth_level string is not a valid AuthLevel name. ``` -------------------------------- ### Extracting Route and Query Parameters Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/http-classes.md Demonstrates how to access route parameters from the URL path and query string parameters from the request object within an Azure Function. ```python from azure.functions import HttpRequest, HttpResponse @app.route(route="items/{category}/{id}") def get_item(req: HttpRequest) -> HttpResponse: # Route parameters from URL path category = req.route_params['category'] item_id = req.route_params['id'] # Query string parameters format = req.params.get('format', 'json') detailed = req.params.get('detailed', 'false').lower() == 'true' return HttpResponse(f"Category: {category}, ID: {item_id}, Format: {format}") ``` -------------------------------- ### Cosmos DB Output Binding Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/triggers-bindings.md Use this decorator to send documents or lists of documents to Cosmos DB. Requires database and collection names, and a connection string setting. ```python @app.cosmos_db_output( arg_name: str, database_name: str, collection_name: str, connection_string_setting: str, create_if_not_exists: Optional[bool] = None, partition_key: Optional[str] = None, collection_throughput: Optional[int] = None, use_multiple_write_locations: Optional[bool] = None, preferred_locations: Optional[str] = None, data_type: Optional[Union[DataType, str]] = None, **kwargs ) -> Callable ``` -------------------------------- ### Create and Merge Blueprints for API and Jobs Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/blueprint.md Defines two blueprints, one for API v1 routes and another for background jobs triggered by a queue. These blueprints are then merged into a main FunctionApp. ```python from azure.functions import HttpRequest, HttpResponse from azure.functions.decorators import Blueprint, FunctionApp # Create reusable blueprint for API v1 api_v1 = Blueprint() @api_v1.route(route="api/v1/items") def list_items_v1(req: HttpRequest) -> HttpResponse: return HttpResponse("Items v1") @api_v1.route(route="api/v1/items/{id}", methods=["GET"]) def get_item_v1(req: HttpRequest) -> HttpResponse: item_id = req.route_params['id'] return HttpResponse(f"Item {item_id} v1") # Create reusable blueprint for background jobs jobs = Blueprint() @jobs.queue_trigger(arg_name="msg", queue_name="jobs", connection="AzureWebJobsStorage") def process_job(msg): print(f"Processing: {msg.get_body()}") @jobs.queue_output(arg_name="output", queue_name="results", connection="AzureWebJobsStorage") def enqueue_result(output): output.set("Job completed") # Create main function app app = FunctionApp() @app.route(route="health") def health_check(req: HttpRequest) -> HttpResponse: return HttpResponse("OK") # Merge blueprints for bp in [api_v1, jobs]: app._function_builders.extend(bp._function_builders) # Now app contains all functions from both blueprints and the main app ``` -------------------------------- ### BindingRegistry.get_all_bindings() Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/binding-registry.md Retrieves a list of all binding information objects that are currently registered in the binding registry. ```APIDOC ## BindingRegistry.get_all_bindings() ### Description Get all registered bindings. This method returns a list containing information for every binding type known to the registry. ### Returns `List[BindingInfo]` - List of all registered bindings. ### Example ```python registry = get_binding_registry() bindings = registry.get_all_bindings() for binding_info in bindings: print(f"Binding: {binding_info.name}") ``` ``` -------------------------------- ### AsgiMiddleware Class Definition Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/types.md A wrapper class for integrating ASGI applications within Azure HTTP functions. It enables the use of modern ASGI frameworks with Azure Functions. ```python class AsgiMiddleware ``` -------------------------------- ### WarmUpContext Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/types.md Provides context for warmup trigger functions in Azure Functions. ```APIDOC ## Class: WarmUpContext ### Description Context for warmup trigger functions. ### Source `azure.functions.warmup.WarmUpContext` ``` -------------------------------- ### generic_input_binding() / generic_output_binding() Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/triggers-bindings.md Provides custom input or output binding capabilities for unsupported data types. Requires specifying the binding type. ```APIDOC ## generic_input_binding() / generic_output_binding() ### Description Custom input or output binding for unsupported types. ### Method `generic_input_binding` or `generic_output_binding` ### Parameters - **arg_name** (str) - Required - The name of the argument. - **type** (str) - Required - The custom binding type name. - **data_type** (Optional[Union[DataType, str]]) - Optional - The data type for the binding. ### Returns - `Callable` - A callable for the custom binding. ``` -------------------------------- ### Document Supported Bindings Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/binding-registry.md This snippet retrieves all registered bindings from the binding registry and prints their names. It's useful for documenting the full list of bindings supported by the Azure Functions environment. ```python from azure.functions import get_binding_registry registry = get_binding_registry() bindings = registry.get_all_bindings() print("Supported Azure Functions Bindings:") print("=" * 50) for binding_info in bindings: print(f"• {binding_info.name}") ``` -------------------------------- ### Set Access Rights for Service Bus Queue Output Binding Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/configuration.md Configure the access rights for the connection string used by Service Bus queue output bindings. Use AccessRights.MANAGE for full permissions, including sending messages. ```python @app.service_bus_queue_output( arg_name="output", connection="ServiceBusConnection", queue_name="myqueue", access_rights=AccessRights.MANAGE # Can send messages ) def send_message(output): output.set("Message content") ``` -------------------------------- ### app_script_file property Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/function-app.md Returns the name of the script file where functions are defined. Defaults to 'function_app.py'. ```APIDOC ## app_script_file ### Description Returns the name of the script file where functions are defined. Default: "function_app.py" ### Property Signature ```python @property def app_script_file(self) -> str ``` ### Return Type `str` ``` -------------------------------- ### Configure DataType for Blob Input Binding Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/configuration.md Specify how the Functions runtime should parse parameter values from blob input bindings. Use DataType.BINARY to parse as bytes. ```python @app.blob_input( arg_name="blob", path="uploads/{name}", connection="AzureWebJobsStorage", data_type=DataType.BINARY # Parse as bytes ) def process_blob(blob): # blob is bytes pass ``` -------------------------------- ### Import Azure Functions Middleware Classes Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/README.md Imports classes for integrating WSGI and ASGI middleware with Azure Functions, including WsgiMiddleware and AsgiFunctionApp. ```python # Middleware from azure.functions import ( WsgiMiddleware, AsgiMiddleware, WsgiFunctionApp, AsgiFunctionApp, ) ``` -------------------------------- ### Import Context Class for Azure Functions Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/EXPORTS.md Import the Context class, which provides runtime information for Azure Functions. ```python from azure.functions import ( Context, ) ``` -------------------------------- ### sql_output() Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/triggers-bindings.md Outputs data to a SQL Database. Accepts a dictionary or a list of dictionaries. ```APIDOC ## sql_output() ### Description Outputs data to a SQL Database. ### Method Decorator ### Parameters #### Path Parameters - **arg_name** (str) - Required - The name of the argument. - **command_text** (str) - Required - The SQL command text. - **connection_string_setting** (str) - Required - The name of the SQL connection string setting. #### Query Parameters - **parameters** (Optional[str]) - Optional - The parameters for the SQL command. - **data_type** (Optional[Union[DataType, str]]) - Optional - The data type for the output. ### Response #### Success Response - **Callable**: Returns a callable. ### Reference https://aka.ms/azure-function-binding-sql ``` -------------------------------- ### mysql_output() Source: https://github.com/azure/azure-functions-python-library/blob/dev/_autodocs/api-reference/triggers-bindings.md Outputs data to a MySQL Database. Accepts a dictionary or a list of dictionaries. ```APIDOC ## mysql_output() ### Description Outputs data to a MySQL Database. ### Method Decorator ### Parameters #### Path Parameters - **arg_name** (str) - Required - The name of the argument. - **command_text** (str) - Required - The SQL command text. - **connection_string_setting** (str) - Required - The name of the MySQL connection string setting. #### Query Parameters - **parameters** (Optional[str]) - Optional - The parameters for the SQL command. - **data_type** (Optional[Union[DataType, str]]) - Optional - The data type for the output. ### Response #### Success Response - **Callable**: Returns a callable. ### Reference https://aka.ms/azure-function-binding-mysql ```