是否有一种方法可以使用kusto语言以编程方式检查日志分析中是否存在表?
例如,假设我要检查工作空间是否包含VMConnection表,例如:
IF OBJECT_ID('*objectName*', 'U') IS NOT NULL
OR
IF (EXISTS (SELECT *
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'TheSchema'
AND TABLE_NAME = 'TheTable'))
BEGIN
--Do Stuff
END
答案 0 :(得分:2)
也许,您可以使用下一种技术来检查是否存在非空表:
let hasNonEmptyTable = (T:string)
{
toscalar( union isfuzzy=true ( table(T) | count as Count ), (print Count=0) | summarize sum(Count) ) > 0
};
let TableName = 'StormEvents';
print Table=TableName, IsPresent=iif(hasNonEmptyTable(TableName), "Table present", "Table not preset")
您可以尝试使用online来运行https://dataexplorer.azure.com/clusters/help/