On Mon, May 14, 2012 at 5:20 PM, Oliver Tonnhofer <olt...@gmail.com> wrote:
> Hi,
>
> how can I execute a statement for each new connection. I'm using the trigram
> module (pg_trgm) for PostgreSQL and I need to set a threshold by calling an
> SQL function for each new connection (`select set_limit(0.5);`).
>
> I'm using the expression API and `engine.execute`. I looked at the event
> API, but the `connect` event does not give me a Connection to execute the
> statement. Are there any other options?
>

According to:

 
http://docs.sqlalchemy.org/en/rel_0_7/core/events.html#sqlalchemy.events.PoolEvents.connect

'connect' event handlers look like this:

  connect(dbapi_connection, connection_record)

Can't you use the dbapi_connection to call your SQL function?

Simon

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to