Answer the question
In order to leave comments, you need to log in
Python can't configure dump?
Вот такой код:
con = psycopg2.connect(user='*', password='*', host='*', dbname='*', port=5432)
cur = con.cursor()
today = date.today()
month = today.replace(year=today.year - 1, month=today.month, day=today.day)
month = month.strftime("%Y-%m")
cur.execute('''select * from "SC_Tag"."tagdata_%s";'''% month)
ver = cur.fetchone()
print ver
try:
dumpcmd ='''PGPASSWORD="*" pg_dump -h *.ru -p 5432 -U * -F p -E UTF8 -Z 9 -t "SC_Tag"."tagdata_2014-12" -v -f "D:\postgres\pg\my12.gzip" DB_ASUTP_2'''
cur.execute('''DROP TABLE "SC_Tag"."tagdata_%s";'''% month)
print 'lol'
except:
print "I can't drop our test database!"
print cur.query
cur.execute('''DROP TABLE "SC_Tag"."tagdata_%s";'''% month)
print cur.query
DROP TABLE "SC_Tag"."tagdata_2014-06";
dumpcmd ='''pg_dump -h *ru -p 5432 -U user -F p -E UTF8 -Z 9 -t "SC_Tag"."tagdata_2014-12" -v -f "D:\postgres\pg\my12.gzip" DB_ASUTP_2'''
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question