将json数据从文件加载到Postgres

将json数据从文件加载到Postgres,第1张

将json数据从文件加载到Postgres

试试这个:

BEGIN;-- let's create a temp table to bulk data intocreate temporary table temp_json (values text) on commit drop;copy temp_json from 'C:SAMPLE.JSON';-- uncomment the line above to insert records into your table-- insert into tbl_staging_eventlog1 ("EId", "Category", "Mac", "Path", "ID")select values->>'EId' as EId,       values->>'Category' as Category,       values->>'Mac' as Mac,       values->>'Path' as Path,       values->>'ID' as ID      from   (select json_array_elements(replace(values,'','\')::json) as values from   temp_json       ) a; COMMIT;


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5622911.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-15
下一篇 2022-12-15

发表评论

登录后才能评论

评论列表(0条)

保存