Azure SQL Edge streaming reading from JSON

68 views Asked by At

I'm trying to place JSON in a table where each key would be a value in a column, and I receive these two types of errors:

  1. 09/27/2023 16:41:00, "/SUBSCRIPTIONS/SUBSCRIPTIONID/RESOURCEGROUPS/RESOURCEGROUP/PROVIDERS/MICROSOFT.STREAMANALYTICS/STREAMINGJOBS/MUVUDB.MONITORINGVARIABLESDATA", "Send Events", "Execution", "InProgress", "Warning", "{"Source":"MonitoringVariablesOutput","Type":"DataError","DataErrorType":"OutputDataConversionError.TypeConversionError","BriefMessage":null,"ErrorCode":"DatabaseOutputTypeConversionError","ErrorCategory":"DataError","Message":"Cannot convert from property 'valueDec' of type 'System.String' to column 'valueDec' of type 'System.Double'.","ExampleEvents":"[\"{\\"monitoringVariableId\\":\\"test\\",\\"readTime\\":\\"test2\\",\\"aggregationVariable\\":\\"test3\\",\\"valueStr\\":\\"test4\\"}\"]","FromTimestamp":"2023-09-27T16:41:00.5952370Z","ToTimestamp":"2023-09-27T16:41:00.5953991Z","EventCount":1}"]

  2. The value of the key valueDec (float) is stored in valueStr (nvarchar), even if the keys are diferent in JSON.

The azuredatastudio configuration and edge module code were working in the past in other devices.

My edge module has the following code to in NodeJS to send the json:

var body = {
          monitoringVariableId: "test",
          readTime: "test2",
          aggregationVariable: "test3",
          valueDec: 4
        }
var message = JSON.stringify(body)
var outputMsg = new Message(message);
client.sendOutputEvent("output1", outputMsg);

Don't know if it is a newer version of Azure SQL Edge, this never happenend to me... It seems that azureSQLEdge is not doing the parse in my message and every value is String.

1

There are 1 answers

0
Sampath On
  • Create a Azure IoT Hub and IOT edge.

enter image description here

enter image description here

  • Create a module by adding AzureSQLEdge in IoT Edge Modules enter image description here

  • Deploy Azure SQL Edge

  • Connect and query Azure SQL Edge with nodejs refer SO.

  • Sync data from Azure SQL Edge by using Azure Data Factory

  • Build Graph Node and Edge Tables using Azure Data Studio.