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 here:
> http://www.postgresql.org/docs/current/static/monitoring-stats.html
>
> I see. Thanks, that's very helpful. Does the pid/process stay the same
> across successive calls to text()? I'm guessing that successive calls
> to text() would take place within the same session, and therefore
> correspond to the same backend session.
>
> If not, how can I get it to return the pid before I start the actual
> query? In any case, I'll experiment with this.
you would connect:
conn = engine.connect()
check the PID:
pid = conn.execute("SELECT pg_backend_pid()").scalar()
then continue as needed:
conn.execute(text(...))
>
> Regards, Faheem.
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/sqlalchemy?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.