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

Kusto布尔值内联摄入失败及JSON映射本地字符串摄入问题

Kusto数据摄入问题解答

一、布尔列的正确摄入方式

Kusto的bool类型在使用.ingest inline命令时,必须使用小写的true或false作为值,数字1/0不会被自动识别为布尔值,这就是IsPrimary列为空的原因。

正确的.ingest inline命令示例:

.ingest inline into table Records <|
src1,dest1,true,2024-01-01T00:00:00,100
src2,dest2,false,2024-01-02T00:00:00,200

如果必须用数字表示布尔值,可在摄入时通过查询转换处理:

.ingest inline into table Records <|
src1,dest1,1,2024-01-01T00:00:00,100
src2,dest2,0,2024-01-02T00:00:00,200
| extend IsPrimary = tobool(IsPrimary)

二、使用JSON映射直接摄入JSON字符串

若已创建JSON摄入映射,可通过指定format=json和ingestionMappingReference参数,直接在命令中传入JSON字符串(每条记录为单独的JSON对象,换行分隔)。

假设JSON映射名称为RecordsJsonMapping,示例命令如下:

.ingest inline with (format=json, ingestionMappingReference='RecordsJsonMapping') <|
{"Source": "src1", "Destinitation": "dest1", "IsPrimary": true, "MigratedOn": "2024-01-01T00:00:00", "Count": 100}
{"Source": "src2", "Destinitation": "dest2", "IsPrimary": false, "MigratedOn": "2024-01-02T00:00:00", "Count": 200}

如果JSON数据是数组格式,可额外指定ingestionMappingType='JsonArray'解析:

.ingest inline with (format=json, ingestionMappingReference='RecordsJsonMapping', ingestionMappingType='JsonArray') <|
[
    {"Source": "src1", "Destinitation": "dest1", "IsPrimary": true, "MigratedOn": "2024-01-01T00:00:00", "Count": 100},
    {"Source": "src2", "Destinitation": "dest2", "IsPrimary": false, "MigratedOn": "2024-01-02T00:00:00", "Count": 200}
]

内容的提问来源于stack exchange,提问作者Ahmad Masalha

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.23 15:45:13