Clickhouse: cannot parse json expected opening quote at row 1

Created on 5 Dec 2017  路  2Comments  路  Source: ClickHouse/ClickHouse

I'm not sure what I'm doing wrong. the json is valid.

CREATE TABLE http
(
day Date DEFAULT toDate(ts),
ts DateTime,
uid String,
orig_h String,
orig_p UInt16,
resp_h String,
resp_p UInt16,
trans_depth String,
method String,
host String,
uri String,
referrer String,
version String,
user_agent String,
request_body_len String,
response_body_len String,
status_code String,
status_msg String,
info_code String,
info_msg String,
username String,
password String,
proxied String,
tags Array(String),
orig_fuids Array(String),
orig_filenames Array(String),
orig_mime_types Array(String),
resp_fuids Array(String),
resp_filenames Array(String),
resp_mime_types Array(String)
)
ENGINE = MergeTree(day, halfMD5(uid), (day, halfMD5(uid), uid), 8192)

Ok.

0 rows in set. Elapsed: 0.009 sec.

$ cat 1
{
"orig_h": "172.16.1.169",
"uid": "ASDASDFASFWE",
"status_code": "304",
"resp_filenames": [],
"orig_mime_types": [],
"orig_p": "56792",
"info_msg": "",
"trans_depth": "1",
"request_body_len": "0",
"resp_h": "192.0.73.2",
"orig_fuids": [],
"ts": "1512468017",
"version": "1.1",
"resp_mime_types": [],
"method": "GET",
"username": "",
"tags": [],
"proxied": [],
"resp_fuids": [],
"response_body_len": "0",
"host": "www.google.com",
"info_code": "",
"orig_filenames": [],
"password": "",
"day": "2017-12-05",
"resp_p": "80",
"status_msg": "Not Modified",
"uri": "/avatar/123123123123123?s=72&d=123123123",
"user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36",
"referrer": "http://google.com/"
}

curl -X POST --data @1 "http://localhost:8123/?query=INSERT+INTO+http+FORMAT+JSONEachRow&input_format_skip_unknown_fields=1"
Code: 26, e.displayText() = DB::Exception: Cannot parse JSON string: expected opening quote: (at row 1)
, e.what() = DB::Exception

Most helpful comment

Very unreadable response, but generally you're trying to insert Array data inside string field.
Compare "proxied": [] in json vs proxied String in schema.

All 2 comments

Very unreadable response, but generally you're trying to insert Array data inside string field.
Compare "proxied": [] in json vs proxied String in schema.

Yes, thanks! That was the case.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jangorecki picture jangorecki  路  3Comments

fizerkhan picture fizerkhan  路  3Comments

innerr picture innerr  路  3Comments

zhicwu picture zhicwu  路  3Comments

atk91 picture atk91  路  3Comments