JSON Failed to import

Brian Hood brianh6854 at googlemail.com
Thu Apr 21 22:40:24 CEST 2016


Hi Ariel,

I had fun with MonetDB and JSON a while here is a valid insert with JSON.

CREATE TABLE "threatmonitor"."http_traffic_json" (
"id"        INTEGER       NOT NULL DEFAULT next value for
"threatmonitor"."seq_7448",
"guid"      CHAR(36),
"recv_date" DATE,
"recv_time" TIME,
"json_data" JSON,
CONSTRAINT "http_traffic_json_id_pkey" PRIMARY KEY ("id")
);

Structured Query: INSERT INTO http_traffic_json
(recv_time,recv_date,guid,json_data) VALUES (NOW(), NOW(),
'2458089a-356d-097e-8905-922348b5cb8a', '{ "http": { "host": "
www.starbucks.co.uk","connection": "keep-alive","accept": "*/*","referer": "
http://www.starbucks.co.uk/","acceptencoding": "gzip, deflate,
sdch","acceptlanguage": "en-GB,en-US;q=0.8,en;q=0.6","cookie":
"ommited","url":"http://www.starbucks.co.uk/static/images/favicon.ico" }
}'); Result: #<MonetDBData:0x00000002d57a08>

Hope this helps.

Regards,

Brian Hood


On Thu, Apr 21, 2016 at 8:29 PM, Ariel Abadi <aabadi at starconnecting.com>
wrote:

> Sorry forgot to include on my email the error received.
>
> Error loading data: 22000!Failed to import table line 1 field 2 'json'
> expected in '{\"data\":[{\"cdr_dialnumber\":\"5579996871820\"}]}'
>
>
> Rgds
>
>
>
> *Ariel Abadi*
> Direct: +54 11 5279.2054
> Mobile:+54 9 11 6050.0101
> Email: aabadi at starconnecting.com
> Web: www.starconnecting.com
>
> On Thu, Apr 21, 2016 at 4:26 PM, Ariel Abadi <aabadi at starconnecting.com>
> wrote:
>
>> Hi!
>>
>> Can someone help me ? Im trying to upload a CSV file with json data, but
>> Im receiving an error. Does anybody has an idea how to solve this?
>>
>> Thks in advance
>>
>> mclient  -s"COPY 1 RECORDS INTO traf.jsontbl FROM STDIN  USING
>>  DELIMITERS  '|','\n','\"' NULL AS 'null'" - < j.csv
>>
>> *The data on j.csv is:*
>> 301|"{\"data\":[{\"cdr_dialnumber\":\"6596871820\"}]}"
>>
>>
>> *TABLE  traf.xx*
>> sql>\d jsontbl
>> CREATE TABLE "traf"."jsontbl" (
>> "a" INTEGER,
>> "b" JSON
>> );
>>
>>
>
> _______________________________________________
> users-list mailing list
> users-list at monetdb.org
> https://www.monetdb.org/mailman/listinfo/users-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.monetdb.org/pipermail/users-list/attachments/20160421/b6c57650/attachment-0001.html>


More information about the users-list mailing list