Copy database with python..

Abandoned besturk at gmail.com
Fri Nov 2 10:32:46 EDT 2007


On Nov 2, 4:19 pm, Paul McNett <p... at ulmcnett.com> wrote:
> 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")
> > What is the problem ? And how can i copy the database with python ?
>
> You are just going to have to give us more to go on. Please post the
> entire traceback of the error that you see (copy/paste it from your
> terminal).
>
> You can't issue system commands using the cursor's execute() method and
> expect that to work. execute() is for executing SQL, DML, or DDL, not
> for doing shell stuff.
>
> Try:
>
> import os
> os.system("pg_dump mydata > /tmp/old.dump")
>
> but I'm not versed in postgressql, so this probably won't work exactly
> as written. You'd need to run that code from the server hosting the
> postgresql database.
>
> > Note: The database's size is 200 GB
>
> Well, then you may want to make sure you have enough room on the target
> volume before trying to dump the file! Note that the dump file could
> conceivably be much larger (or much smaller) than the database itself.
>
> --
> pkm ~http://paulmcnett.com

Are there any way to copy database without dump or any temp files ?
(If there is a temp my harddisk not enough for this operation :( )




More information about the Python-list mailing list