简体   繁体   English

使用 JSON 数据查询来自 Azure 流分析的 Power BI 输出

[英]Query for Power BI Output from Azure Stream Analytics with JSON data

I'm having an issue extracting data from IOT Hub to Azure Stream Analytics to Power BI.我在将数据从 IOT Hub 提取到 Azure Stream Analytics 到 Power BI 时遇到问题。

Here is the data coming from Stream Analytics:以下是来自 Stream Analytics 的数据:

{  
   "header":{  
      "version":1
   },
   "data":{  
      "treatmentId":"1",
      "machineData":[  
         {  
            "recordId":3,
            "records":[  
               {  
                  "fields":[  
                     {  
                        "value":"+182",
                        "key":"VP"
                     }
                  ],
                  "group":"PR"
               }
            ]
         }
      ]
   },
   "EventProcessedUtcTime":"2018-12-05T16:52:43.6450807Z",
   "PartitionId":0,
   "EventEnqueuedUtcTime":"2018-12-05T16:38:47.1900000Z",
   "IoTHub":{  
      "CorrelationId":null

   }
}

Using the following query:使用以下查询:

SELECT * 
INTO DataPowerBI
FROM iothub;

I am getting the following output in PowerBI:我在 PowerBI 中得到以下输出:

在此处输入图片说明

I am not able to get the child level data under "data", like treatment id, machine data, groups, keys.我无法在“数据”下获取子级数据,例如处理 ID、机器数据、组、键。 Can I get a query for pushing all levels of the data, both parent and children?我可以查询推送所有级别的数据,包括父级和子级吗?

Thanks in advance!提前致谢! Raj拉吉

By using select *, you only get the upper level data-fields back.通过使用 select *,您只能返回上层数据字段。 If you want the data that is nested, you need to specify the data you want.如果你想要嵌套的数据,你需要指定你想要的数据。

select data.treatmentid will get you the treatmentId选择 data.treatmentid 将为您提供treatmentId

I am not sure how it works with nesting within nesting.我不确定它如何与嵌套中的嵌套一起使用。 You could try select data.machinedata.recordId to get the recordId.您可以尝试选择 data.machinedata.recordId 来获取 recordId。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM