Copy database with python..

Carsten Haese carsten at uniqsys.com
Fri Nov 2 10:06:40 EDT 2007


On Fri, 2007-11-02 at 06:51 -0700, Abandoned wrote:
> Hi.
> I want to copy my database but python give me error when i use this
> command.
> cursor.execute("pg_dump mydata > old.dump")

cursor.execute executes SQL queries. pg_dump is not an SQL query, it is
an operating system command. To execute OS commands, use
os.system("...") or the subprocess module.

Hope this helps,

-- 
Carsten Haese
http://informixdb.sourceforge.net





More information about the Python-list mailing list