Azure / azure-functions-sql-extension

Azure SQL bindings for Azure Functions ⚡️ supports Azure SQL Database, Azure SQL Managed Instance, and SQL Server 2016+
https://aka.ms/sqlbindings
MIT License
115 stars 55 forks source link

Output binding shall allow to use transactional batch #659

Open petr-hollay opened 1 year ago

petr-hollay commented 1 year ago

Output binding shall allow to use transactional batch.

Docs: Transactional batch operations in Azure Cosmos DB using the .NET or Java SDK | Microsoft Learn

Blog: Introducing TransactionalBatch in the Azure Cosmos DB .NET SDK - Azure Cosmos DB Blog (microsoft.com)

It is not supported in azure-functions-sql-extension/SqlAsyncCollector.cs at main · Azure/azure-functions-sql-extension · GitHub

Charles-Gagnon commented 1 year ago

Can you provide more information about why this feature is needed and how you would expect it to work? You can use an AsyncCollector and call flush yourself which gives you full control over when the upsert occurs.

jensbarthel commented 1 month ago

Hi @Charles-Gagnon, we use the Java bindings to persist messages from service bus to az sql in batches. Wrapping the batched insert in a transaction would give us way better tolerance for faults on the sink/sql side, because we could cleanly leverage service bus retries. Hope that makes sense.