-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathScript.asaql
23 lines (22 loc) · 1020 Bytes
/
Script.asaql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
SELECT
GetMetadataPropertyValue([bhoojal-iot-stream], '[User].[outletId]') AS outletid,
CAST(GetMetadataPropertyValue([bhoojal-iot-stream], '[User].[quota]') as bigint) AS quota,
consumedQuota
INTO
consumptionarchive
FROM
[bhoojal-iot-stream]
SELECT
GetMetadataPropertyValue([bhoojal-iot-stream], '[User].[outletId]') AS outletId,
CONCAT(DATENAME (yyyy, TIMESTAMP),DATENAME (m, TIMESTAMP),DATENAME (dd, TIMESTAMP),'-',GetMetadataPropertyValue([bhoojal-iot-stream], '[User].[outletId]')) AS id,
CAST(GetMetadataPropertyValue([bhoojal-iot-stream], '[User].[quota]') as bigint) AS quota,
consumedQuota,
hardness,
phLevel,
UDF.ParseAlert(consumedQuota, CAST(GetMetadataPropertyValue([bhoojal-iot-stream], '[User].[quota]') as bigint), phLevel, hardness) AS alert
INTO
alertscollection
FROM
[bhoojal-iot-stream]
WHERE
UDF.ParseAlert(consumedQuota, CAST(GetMetadataPropertyValue([bhoojal-iot-stream], '[User].[quota]') as bigint), phLevel, hardness).isAlert = 1