Re: running pg_dump from python

Поиск
Список
Период
Сортировка
От Scott Mead
Тема Re: running pg_dump from python
Дата
Msg-id d3ab2ec80906141409u71c7a177tfb1d462e567b2296@mail.gmail.com
обсуждение исходный текст
Ответ на running pg_dump from python  (Garry Saddington <garry@schoolteachers.co.uk>)
Ответы Re: running pg_dump from python  (Garry Saddington <garry@schoolteachers.co.uk>)
Список pgsql-general
On Sun, Jun 14, 2009 at 4:06 PM, Garry Saddington <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?  What user is this running as?  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

     Try running that on the commandline first, by itself, as the same user that runs the python script.  If it works, then you know for sure that any problems from here on out are just a function of the python script and not pg_dump itself.

--Scott

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

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