基于 Kusto/Data Explorer 中的列名称列表的项目列

Project columns based on list of column names in Kusto / Data Explorer

我有一个包含数百列的 Kusto table。大约一半的列包含日期。每个日期列的名称中都有单词 'date'(例如:'createdDate')。我想 return 仅在列名称中包含“日期”的列。

(注意,“日期”列中的值是字符串)

我正在尝试执行以下操作:

let T1 = datatable (col1:string, col2:string, Date1:string, Date2:string)[
"abc", "def", "2021-11-3", "2021-11-4",
"ghi", "jkl", "2021-11-5", "2021-11-6",
"mno", "pqr", "2021-11-7", "2021-11-8",
"stu", "v", "2021-11-9", "2021-11-10",
"wx", "yz", "2021-11-11", "2021-11-12"];
let ColswithDates = T1
| getschema 
| where ColumnName contains "date";
T1 | project ColswithDates

使用“project-keep”运算符

let T1 = datatable (col1:string, col2:string, Date1:string, Date2:string)[
"abc", "def", "2021-11-3", "2021-11-4",
"ghi", "jkl", "2021-11-5", "2021-11-6",
"mno", "pqr", "2021-11-7", "2021-11-8",
"stu", "v", "2021-11-9", "2021-11-10",
"wx", "yz", "2021-11-11", "2021-11-12"];
let ColswithDates = T1
| getschema 
| where ColumnName contains "date";
T1 | project-keep *Date*
Date1 Date2
2021-11-3 2021-11-4
2021-11-5 2021-11-6
2021-11-7 2021-11-8
2021-11-9 2021-11-10
2021-11-11 2021-11-12