Copy database with python..

Abandoned besturk at gmail.com
Fri Nov 2 10:29:13 EDT 2007


On Nov 2, 4:11 pm, Martin Sand Christensen <m... at es.aau.dk> wrote:
> >>>>> "Abandoned" == Abandoned  <best... at gmail.com> writes:
>
> Abandoned> I want to copy my database but python give me error when i
> Abandoned> use this command. cursor.execute("pg_dump mydata > old.dump")
> Abandoned> What is the problem ?
>
> cursor.execute() is for executing SQL commands, and this is not an SQL
> command, but rather a shell command.
>
> Abandoned> And how can i copy the database with python ? Note: The
> Abandoned> database's size is 200 GB
>
> If you want to do this from Python, run it as a separate process.
>
> Martin
Yes i understand thank you.
Now i find that maybe help the other users.

import os
os.system("su postgres")
...
..




More information about the Python-list mailing list