Get rid of postgres warning

Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
This commit is contained in:
Patrick Uiterwijk 2018-05-18 13:03:26 +02:00
parent e18ba2107b
commit b6f06b4a27

View file

@ -46,7 +46,8 @@ TO '{tmpfile}' delimiter ',' CSV header;
query = query.format(username=username, tmpfile=tempfilename)
command = ['sudo', '-u', 'postgres', 'psql', 'datanommer', '-c', '"%s"' % query]
subprocess.check_call(
' '.join(command), shell=True, stdout=subprocess.PIPE)
' '.join(command), shell=True, stdout=subprocess.PIPE,
cwd='/tmp')
with open(tempfilename) as stream:
data = stream.read()
os.unlink(tempfilename)