Reputation: 7259
I'm building a durable function that periodically processes every record in my Cosmos DB (nights and weekends). Right now I only have a few hundred records, but once I get into production, I'm anticipating >50k documents to come in with ~1k per week being added.
I am getting the documents via an activityTrigger
with the following bindings:
{
"bindings": [
{
"name": "name",
"type": "activityTrigger",
"direction": "in"
},
{
"type": "cosmosDB",
"direction": "in",
"name": "articles",
"databaseName": "Arts",
"collectionName": "ArtData",
"connectionStringSetting": "CosmosTrigger_ConnectionString",
"sqlQuery": "SELECT * FROM c WHERE c.type='article'"
}
],
"scriptFile": "../dist/GetAllArticleData/index.js"
}
Is there a limit to the total number of documents that are returned to an Azure Function via an SQL Query binding? Or does Azure Functions automatically handle the pagination and there is no upper limit?
If there is no pagination built in, what about chaining durable functions together, where the first activity gets the total row count, then a fan out/in query function is called with the OFFSET and LIMIT clauses being parameters passed in from the orchestrator? Is that a reliable pattern?
Upvotes: 0
Views: 579
Reputation: 15613
The Cosmos DB input binding drains the entire query results and passes them to your Function, no continuation is needed.
If the query has 10 results or 1000, it will drain the query and pass them as input.
Here is the code reference.
Upvotes: 0