in azure/functions/decorators/function_app.py [0:0]
def cosmos_db_input_v3(self,
arg_name: str,
database_name: str,
collection_name: str,
connection_string_setting: str,
id: Optional[str] = None,
sql_query: Optional[str] = None,
partition_key: Optional[str] = None,
data_type: Optional[
Union[DataType, str]] = None,
**kwargs) \
-> Callable[..., Any]:
"""The cosmos_db_input_v3 decorator adds
:class:`CosmosDBInput` to the :class:`FunctionBuilder` object
for building :class:`Function` object used in worker function
indexing model. This decorator will work only with extension bundle 2.x
or 3.x. For additional details, please refer
https://aka.ms/cosmosdb-v4-update.
This is equivalent to defining CosmosDBInput
in the function.json which enables function to read from CosmosDB.
All optional fields will be given default value by function host when
they are parsed by function host.
Ref: https://aka.ms/azure-function-binding-cosmosdb-v2
:param arg_name: The name of the variable that represents
:class:`DocumentList` input object in function code.
:param database_name: The database containing the document.
:param collection_name: The name of the collection that contains the
document.
:param connection_string_setting: The name of the app setting
containing your Azure Cosmos DB connection string.
:param id: The ID of the document to retrieve.
:param sql_query: An Azure Cosmos DB SQL query used for retrieving
multiple documents.
:param partition_key: Specifies the partition key value for the
lookup.
:param data_type: Defines how Functions runtime should treat the
parameter value.
:param kwargs: Keyword arguments for specifying additional binding
fields to include in the binding json.
:return: Decorator function.
"""
@self._configure_function_builder
def wrap(fb):
def decorator():
fb.add_binding(
binding=CosmosDBInputV3(
name=arg_name,
database_name=database_name,
collection_name=collection_name,
connection_string_setting=connection_string_setting,
id=id,
sql_query=sql_query,
partition_key=partition_key,
data_type=parse_singular_param_to_enum(data_type,
DataType),
**kwargs))
return fb
return decorator()
return wrap