[sqlalchemy] Re: obtaining pid of forked process

2010-02-12 Thread Faheem Mitha
On Fri, 12 Feb 2010 11:01:23 -0500, Michael Bayer wrote: > you would connect: > > conn = engine.connect() > > check the PID: > > pid = conn.execute("SELECT pg_backend_pid()").scalar() > > > then continue as needed: > > conn.execute(text(...)) Thanks, Michael. That's very clear and helpful.

Re: [sqlalchemy] Re: obtaining pid of forked process

2010-02-12 Thread Michael Bayer
Faheem Mitha wrote: >> PostgreSQL forks a new backend process when a connection is > established, however. It sounds like that's what you want. Do > "SELECT pg_backend_pid()" to get the PID of the backend process > serving your connection. > >> That and other stat functions are documented her

[sqlalchemy] Re: obtaining pid of forked process

2010-02-12 Thread Faheem Mitha
On Thu, 11 Feb 2010 13:06:03 -0500, Michael Bayer wrote: > Faheem Mitha wrote: >> >> Hi, >> >> sqlalchemy forks a process when it calls the db (in my case PostgreSQL, >> but I don't think it matters) using, for example >> >> from sqlalchemy.sql import text >> s = text(...) > > um, what ? ther

[sqlalchemy] Re: obtaining pid of forked process

2010-02-12 Thread Faheem Mitha
On Fri, 12 Feb 2010 13:33:01 +0100, Alex Brasetvik wrote: > > On Feb 11, 2010, at 18:58 , Faheem Mitha wrote: > >> sqlalchemy forks a process when it calls the db > > No, it does not. > PostgreSQL forks a new backend process when a connection is established, however. It sounds like that's what