6.2. copy

6.2.1. wget

http://www.postgresonline.com/journal/archives/325-Using-wget-directly-from-PostgreSQL-using-COPY-FROM-PROGRAM.html

			
CREATE TABLE worldbank_json(data json);
COPY worldbank_json 
  FROM PROGRAM 'C:/wget/wget.exe -q -O - "$@" "http://api.worldbank.org/countries?format=json&per_page=100&page=1"';
COPY worldbank_json 
  FROM PROGRAM 'C:/wget/wget.exe -q -O - "$@" "http://api.worldbank.org/countries?format=json&per_page=100&page=2"';
COPY worldbank_json 
 FROM PROGRAM 'C:/wget/wget.exe -q -O - "$@" "http://api.worldbank.org/countries?format=json&per_page=100&page=3"';
 
 WITH je AS (SELECT json_array_elements(data->1) AS jd 
FROM  worldbank_json)
SELECT jd->>'id' AS id, jd->>'name' As country, 
  jd#>>'{adminregion,id}' As region_id
FROM je ;
			
			





原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

docker log里面查到如下信息 1:C 31 Mar 2025 13:05:15.440 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 1:C 31 Mar 2025 13:05:15.440 # Redis version=6.2.17, bits=64, commit=00000000, modified=0, pid=1, just started 1:C 31 Mar 2025 13:05:15.440 # Configuration loaded 1:M 31 Mar 2025 13:05:15.440 * monotonic clock: POSIX clock_gettime 1:M 31 Mar 2025 13:05:15.441 * Running mode=standalone, port=6379. 1:M 31 Mar 2025 13:05:15.441 # Server initialized 1:M 31 Mar 2025 13:05:15.441 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect. 1:M 31 Mar 2025 13:05:15.443 * Ready to accept connections 1:M 31 Mar 2025 14:05:16.057 * 1 changes in 3600 seconds. Saving... 1:M 31 Mar 2025 14:05:16.058 * Background saving started by pid 737 737:C 31 Mar 2025 14:05:16.060 * DB saved on disk 737:C 31 Mar 2025 14:05:16.060 * RDB: 0 MB of memory used by copy-on-write 1:M 31 Mar 2025 14:05:16.159 * Background saving terminated with success 1:signal-handler (1743478977) Received SIGTERM scheduling shutdown... 1:M 01 Apr 2025 03:42:57.604 # User requested shutdown... 1:M 01 Apr 2025 03:42:57.604 * Saving the final RDB snapshot before exiting. 1:M 01 Apr 2025 03:42:57.605 * DB saved on disk 1:M 01 Apr 2025 03:42:57.605 # Redis is now ready to exit, bye bye... 1:C 01 Apr 2025 03:42:58.256 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 1:C 01 Apr 2025 03:42:58.256 # Redis version=6.2.17, bits=64, commit=00000000, modified=0, pid=1, just started 1:C 01 Apr 2025 03:42:58.256 # Configuration loaded 1:M 01 Apr 2025 03:42:58.257 * monotonic clock: POSIX clock_gettime 1:M 01 Apr 2025 03:42:58.258 * Running mode=standalone, port=6379. 1:M 01 Apr 2025 0
04-04
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值