将数组分配给 kusto 表

问题描述 投票:0回答:2

我正在尝试将字符串数组分配到数据表中,但我不确定语法有什么问题。

代码:

let array=dynamic(["", ""]);
let table= datatable(id:string) array;//error here Expected: [
kql azure-data-explorer
2个回答
0
投票

所以我解决这个问题的方法是: 让表=数据表(id:字符串)[“”,“”]


0
投票

将 KQL 动态数组转换为表

没有内置函数可以像 array_to_table 那样执行此操作,但您可以使用

mv-expand
cast 数组,如下所示:

let array1 = dynamic(["", ""]);
let table1 = view() {
    print Item = array1 
    | mv-expand Item; 
}; 
table1 

当然,如果您将一些合理的数据放入数组中,您将获得带有名为 Item 的单列的表格输出,如下所示:

let array1 = dynamic(["this", "works"]);
let table1 = view() {
    print Item = array1 
    | mv-expand Item; 
}; 
table1 
项目
这个
有效

至少,您可以自由地将逻辑放入名为 array_to_table 的存储函数中。

© www.soinside.com 2019 - 2024. All rights reserved.