Re: running pg_dump from python

Поиск
Список
Период
Сортировка
От Garry Saddington
Тема Re: running pg_dump from python
Дата
Msg-id 4A3570A8.8030504@schoolteachers.co.uk
обсуждение исходный текст
Ответ на Re: running pg_dump from python  (Scott Mead <scott.lists@enterprisedb.com>)
Ответы Re: running pg_dump from python  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Scott Mead wrote:
> On Sun, Jun 14, 2009 at 4:06 PM, Garry Saddington
> <garry@schoolteachers.co.uk <mailto:garry@schoolteachers.co.uk>> wrote:
>
>     I ahve the following python file that I am running as an external
>     method in Zope.
>
>     def backup():
>       import  os
>       os.popen("c:/scholarpack/postgres/bin/pg_dump scholarpack  >
>     c:/scholarpack/ancillary/scholarpack.sql")
>
>
>     Have you tried running that command on the command line by itself
> (as the same user that runs the phython)?  If that gives you the same
> result, then you know for sure that it's a function of the pg_dump
> options and not the python script.
>
>     Are you looking for the full SQL of the scholarpack database?

Yes
> What user is this running as?
scholarpack but no OS user scholarpack, but why should it create a file
then not fill the contents?
> Remember, in your case, pg_dump is going to try to connect as the OS
> username running your script.  you may want to include the username
> option to pg_dump:
>
>      pg_dump -U <username> scholarpack
Zope is running as user scholarpack and I have tried the above as -U
scholarpack and it works

>
>      Try running that on the commandline first, by itself, as the same
> user that runs the python script.

Looks like the script is at fault
regards
Garry


В списке pgsql-general по дате отправления:

Предыдущее
От: Scott Mead
Дата:
Сообщение: Re: running pg_dump from python
Следующее
От: Tom Lane
Дата:
Сообщение: Re: running pg_dump from python