9 个回答
如果要导入的数据是json的话,json里面的数据格式是这样子的:
[{"id":1,"name":"张三"},{"id ":2,"name ":"李四 "}]
这种数组包裹的话,导入语句是:curl --location-trusted -u root:123456 -H "Expect:100-continue" -H "format: json" -H "jsonpaths: [\"$.user_id\",\"$.name\",\"$.age\"]" -H "strip_outer_array: true" -T demo.json http://${fe_ip}:${fe_http_port}/api/${db}/${table}/_stream_load
发布于:5个月前 (12-16) IP属地:四川省
如果数据是多条,但是没有数组包裹的话,示例如下:
{"user_id":11,"name":"张三","age":64}
{"user_id":12,"name":"李四","age":70}
导入语句是:curl --location-trusted -u root:123456 -H "label:122" -H "Expect:100-continue" -H "format:json" -H "strip_outer_array:false" -H "read_json_by_line:true" -T demo.json -XPUT http://${fe_ip}:${fe_http_port}/api/${db}/${table}/_stream_load
发布于:5个月前 (12-16) IP属地:四川省
stream load 导入csv格式的文件的示例如下:

curl --location-trusted -u root:123456 -H "Expect:100-continue" -H "column_separator:," -H "columns:id,name,age" -T demo.csv -XPUT http://${fe_ip}:${fe_http_port}/api/${db}/${table}/_stream_load
导入成功之后,可以看到success的返回:
发布于:5个月前 (12-16) IP属地:四川省
我来回答
您需要 登录 后回答此问题!