I sent json format from Esp8266 to iot hub but I can't send data from iot hub to sql database by Stream Analytics
When I test query in Stream Analytics job, it's ok but I run Stream Analytics job data can't record to sql database and informed that "degraded"
It sounds like your job may not have the correct permissions to the SQL database.
I suggest configuring a Managed Identity for your Stream Analytics job and using that to create a user with the required permissions in Azure SQL DB as described here
Related
I am trying to get data from my Azure IoT hub to a database, which will be then displayed on a website.
I have seen many ways to ingest data such as azure data explorer cluster and stream analytics jobs. However, the issue i have with data explorer is that i cannot get connection details for the database so i cot connect to it using code. As for stream analytics jobs, MySQL databases are not supported, and I have only have experience with MySQL.
Does anyone know a way i can ingest data from my Azure IoT hub to a MySQL database? Thanks in advance.
You will have to write some code to do this.
You can for instance create an Azure Function that uses an IoTHubTrigger or EventHubTrigger so that the Function receives the messages that are available on the IoT Hub. In the Function, you write code to make sure that the data is inserted in the appropriate tables in your database.
Find some documentation regarding this here.
I'm using Streaming Analytics to retrieve JSON messages being placed on an IoTHub. I need to be able to retrieve, and store, in a SQL Server table, the raw JSON string. I can't seem to find a way to do this. Is it possible?
No, unless you wrap the json as string in another json object that is send to the IoT Hub.
Otherwise the solution would be to try whether you can stringify / construct the json object using a Javascript function and then store it in the database.
Retrieve
Streaming Analytics Job does support retrieve JSON messages from IoT Hub. You can set the event serialization format to JSON type when adding stream input like this:
Store
Streaming Analytics Job support write to SQL Database.
But note:
Currently the Azure SQL Database offering is supported for a job
output in Stream Analytics. However, an Azure Virtual Machine running
SQL Server with a database attached is not supported. This is subject
to change in future releases.
So if you mean "SQL Server table" as Azure Virtual Machine running SQL Server with a database, the answer is "NO" currently.
Getting error messages. Seems this is not possible ?
message is :
The JSON provided in the request body is invalid. Property 'server' value 'postgres-mydatabase123.postgres.database.azure.com' is not acceptable.
According to the documentation this is not possible as currently the support output sinks are
Azure Data Lake Store
SQL Database Blob storage
Event Hub
Power BI
Table Storage
Service Bus Queues
Service Bus Topics
Azure Cosmos DB
Azure Functions (In Preview)
Out of all of these Azure Functions or Event Hub might be interesting to you as they allow custom code to process the data. In your case that would be sending it to the PostgreSQL database.
I have my IoT data flow as below:
Azure IoT Hub(JSON Data)->Stream Analytics->Azure CosmosDB Table API(Table name= Test)
The input to the Streaming Analytics is from IoT Hub(sensor data in JSON format). And I have two outputs from the Streaming Analytics, one is Azure CosmosDB(Table API, Table name is 'Test1' and another output is configured to Blob Storage. The streaming analytics query used for both outputs is same.
Q. I am able to see the data in azure ablob storage container, but I am not able to see the data in 'Test1' table of Azure CosmosDB(Table API) through portal. Please find attached screen shots for reference.
Thanks,
Siva M
Azure CosmosDB TableAPI
ASA Output
Right now Azure Streaming analytics does not support outputting to Azure Cosmos DB Table API.
Thanks,
Yaron
I am developing an application . I am pushing data to event hub .From event hub i need to use stream analytics and push data to DOcumentdb for analytics purpose. Could any one please guide me to push data from stream analytics to documentdb. I could see output to SQL Database,Blob storage,Event Hub,Power BI preview,Table storage, Service Bus Queue, Service Bus Topic only
Edit: this feature is now implemented, and DocumentDB can be used as a sink for Stream Analytics: http://blogs.msdn.com/b/streamanalytics/archive/2015/09/29/stream-analytics-updates-for-the-azure-iot-suite.aspx
Yes this effort has already been started while ago as per the feedback forum and it should be publicly available soon. Please share more feedback about your scenario over there and maybe why Azure Table or SQL output are not satisfying it.
thanks!