mirror of
https://github.com/dimitri/pgloader.git
synced 2025-08-07 23:07:00 +02:00
To allow for importing JSON one-liners as-is in the database it can be interesting to leverage the CSV parser in a compatible setup. That setup requires being able to use any separator character as the escape character.
31 lines
1.4 KiB
Fish
31 lines
1.4 KiB
Fish
LOAD CSV
|
|
FROM INLINE
|
|
INTO postgresql:///pgloader?json
|
|
|
|
WITH truncate,
|
|
fields not enclosed,
|
|
fields terminated by '0x02',
|
|
fields escaped by '0x02'
|
|
|
|
BEFORE LOAD DO
|
|
$$ drop table if exists json; $$,
|
|
$$ CREATE TABLE json (json text); $$;
|
|
|
|
|
|
|
|
{"table-name": "fetch","read":0,"imported":0,"errors":0,"time":"0.000s"}
|
|
{"table-name": "fetch meta data","read":8,"imported":8,"errors":0,"time":"0.026s"}
|
|
{"table-name": "create, truncate","read":0,"imported":0,"errors":0,"time":"0.046s"}
|
|
{"table-name": "long","read":0,"imported":2,"errors":0,"time":"0.069s"}
|
|
{"table-name": "blobs","read":0,"imported":1,"errors":0,"time":"0.021s"}
|
|
{"table-name": "unsigned","read":0,"imported":2,"errors":0,"time":"0.007s"}
|
|
{"table-name": "reals","read":0,"imported":3,"errors":0,"time":"0.007s"}
|
|
{"table-name": "ints","read":0,"imported":3,"errors":0,"time":"0.006s"}
|
|
{"table-name": "def","read":0,"imported":2,"errors":0,"time":"0.007s"}
|
|
{"table-name": "stamps","read":0,"imported":2,"errors":0,"time":"0.007s"}
|
|
{"table-name": "character","read":0,"imported":4,"errors":0,"time":"0.005s"}
|
|
{"table-name": "index build completion","read":0,"imported":0,"errors":0,"time":"0.000s"}
|
|
{"table-name": "Create Indexes","read":0,"imported":0,"errors":0,"time":"0.000s"}
|
|
{"table-name": "Reset Sequences","read":0,"imported":0,"errors":0,"time":"0.015s"}
|
|
{"table-name": "Total streaming time","read":0,"imported":19,"errors":0,"time":"0.216s"}
|