sql - How to insert multiple JSON files into postgresql table at a time? -
sql - How to insert multiple JSON files into postgresql table at a time? -
i have multiple json files, have same format values different based on each transaction. want migrate info postgresql table. best way proceed this?
right now, using next query:
create table test (multiprocess varchar(20), http_referer varchar(50)); insert test select multiprocess, http_referer json_populate_record(null::test, '{"multiprocess": true,"http_referer": "http://localhost:9000/"}');
but, 1 time number of files become large, becomes hard utilize technique. there other way effectively?
you utilize lateral join insert more 1 row @ time:
json as( values('{"multiprocess": true,"http_referer":"http://localhost:9000"}') ,('{"multiprocess": false,"http_referer": "http://localhost:9001/"}') ,('{"multiprocess": true,"http_referer": "http://localhost:9002/"}') ) insert test select multiprocess, http_referer json, lateral json_populate_record(null::test, json.column1::json);
or insert staging table first , populate other table.
sql json database postgresql data-migration
Comments
Post a Comment