Re: running pg_dump from python

Поиск
Список
Период
Сортировка
От Erik Jones
Тема Re: running pg_dump from python
Дата
Msg-id 3D76C887-5183-4278-B889-38D4036AEAFE@engineyard.com
обсуждение исходный текст
Ответ на Re: running pg_dump from python  (Jasen Betts <jasen@xnet.co.nz>)
Ответы Re: running pg_dump from python  (Dimitri Fontaine <dfontaine@hi-media.com>)
Список pgsql-general
On Jun 15, 2009, at 5:17 AM, Jasen Betts wrote:

> On 2009-06-14, 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")
>
> are you sure you're using os.popen correctly?
> you don't appear to be waiting for the pg_dump process to finish.



Right, the popen stuff should be something like:

p = os.popen("c:/scholarpack/postgres/bin/pg_dump scholarpack  > c:/
scholarpack/ancillary/scholarpack.sql 2> c:/scholarpack/ancillary/
dump.err")
status = p.close()

Then check status to see if the command was successful or not.

Erik Jones, Database Administrator
Engine Yard
Support, Scalability, Reliability
866.518.9273 x 260
Location: US/Pacific
IRC: mage2k






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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Could not reattach to shared memory
Следующее
От: Tom Lane
Дата:
Сообщение: Re: FYI: Load times for a largish DB in 8.2 vs. 8.3 vs. 8.4