You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何结合let语句使用.set-or-append进行数据摄入?

Azure Data Explorer中.set-or-append与let语句的正确用法

你的初始写法不符合ADX的语法规则,因此报错。ADX的控制命令(如.set-or-append)要求所有let变量定义必须放在命令的查询管道内部,而非外部。

错误原因分析

  • 初始写法将let放在.set-or-append之前,属于语法错误,ADX无法识别该结构,因此抛出"The incomplete fragment is unexpected."错误。
  • 若将let移到.set-or-append下方,此时let语句和后续控制命令是两个独立执行块,let定义的变量未被实际调用,查询仍执行Test | where Column startswith "2",自然摄入行数不符合预期。

正确写法(单个let语句)

将let嵌入到.set-or-append的查询逻辑中:

.set-or-append Test <|
let HexCode = "2";
Test
| where Column startswith HexCode

多个let语句的实现

多个let同样放在查询管道内部,按顺序定义即可:

.set-or-append Test <|
let HexCode = "2";
let FilterPrefix = strcat(HexCode, "_");
Test
| where Column startswith HexCode or Column startswith FilterPrefix

内容的提问来源于stack exchange,提问作者Guilherme Matheus

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.27 04:43:07