我创建了一个Azure功能,可在设备将数据发送到Azure IoT中心时将结果返回给设备。我按照tutorial将输出发送到SQL和Azure功能。这是我的ASA查询。
WITH subquery as (
SELECT
messageId,
deviceId,
temperature,
humidity,
EventProcessedUtcTime,
DemoML(temperature, humidity) as result1
from DemoInput
)
SELECT
messageId as messageId,
deviceId as deviceId,
temperature as temperature,
humidity as humidity,
EventProcessedUtcTime as EventProcessedUtcTime,
result1.[Scored Labels] as result,
result1.[Scored Probabilities] as resultProbability
INTO
[DemoOutput]
FROM
[subquery]
SELECT
*
INTO
[c2d]
FROM
[subquery]
我不知道为什么它不会触发Azure功能。但是当我将[subquery]的最后一行更改为[DemoInput]时,它将起作用。为什么会这样?
答案 0 :(得分:0)
仅针对测试目的尝试以下查询。请注意,我取出了您的DemoML功能,输出用于Blob存储。您应该在AF和Blob存储中看到输出:
WITH subquery as (
SELECT
System.Timestamp as time,
temperature,
humidity,
EventProcessedUtcTime,
IoTHub.ConnectionDeviceId as deviceId,
IoTHub.MessageId as messageId
FROM
DemoInput Timestamp by time
)
SELECT
messageId as messageId,
deviceId as deviceId,
temperature as temperature,
humidity as humidity,
EventProcessedUtcTime as EventProcessedUtcTime
INTO
DemoOutputBlob
FROM
subquery
SELECT
*
INTO
c2d
FROM
subquery