![](/img/trans.png)
[英]How to run shell script as postgres on remote server using fabric python
[英]How to run a postgres command in python script and write it into a file?
cmd1 = 'psql -h hello.com -p 5433 -U hell_ro-d hello-c \"COPY (SELECT info1,info2,info3,info4 FROM logs_info WHERE info1 > \''+str(timing)+'\' and info1 < clock_timestamp() ORDER BY info1 desc limit 100) TO STDOUT With CSV HEADER\" > filedetails.csv'
您可以使用 os.system 运行os.system
命令:
$ python -c 'from os import system; system("cat >/dev/stderr <<<\"shelly stuff\"")'
shelly stuff
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.