Can Stream Analytics Update values in an existing table in Cosmos DB PostgreSQL?

Ben Rad 0 Reputation points
2023-09-25T00:36:43.08+00:00

Hi,

I was wondering if I could update data in Cosmos DB for PostgreSQL table using Stream Analytics.

I receive data through IOTHub and instead of adding rows of data I need to update values in different rows and columns.

It seems that Stream Analytics only insert new data.

If not possible to update data, can I use Azure function and python to update data in PostgreSQL table.

Regards,

Ben

Azure Stream Analytics
Azure Stream Analytics
An Azure real-time analytics service designed for mission-critical workloads.
331 questions
Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,454 questions
Azure Database for PostgreSQL
{count} votes

1 answer

Sort by: Most helpful
  1. Sedat SALMAN 13,170 Reputation points
    2023-09-25T02:39:40.58+00:00

    You can use Azure Database for PostgreSQL as an output for data that's relational in nature or for applications that require content to be hosted in a relational database. Azure Stream Analytics jobs write to an existing table in a PostgreSQL database.

    https://learn.microsoft.com/en-us/azure/stream-analytics/postgresql-database-output

    However, you can leverage Azure Functions to handle this. With an Azure Function triggered by Stream Analytics, you can utilize Python to connect to your Cosmos DB with the PostgreSQL API and update your data accordingly.