On Mar 17, 2010, at 9:45 PM, chris e wrote:

> Because of the way that we have our Oracle database setup, I have to
> do the following to force every connection to use exact cursor
> sharing.
> 
>    dbapi = engine.dialect.dbapi
>    orig_connect = dbapi.connect
>    def exact_connect(*args, **kwargs) :
>        conn_obj = orig_connect(*args, **kwargs)
>        cursor = conn_obj.cursor()
>        cursor.execute('alter session set cursor_sharing = exact');
>        cursor.close()
>        return conn_obj
>    dbapi.connect = exact_connect
> 
> Is there a better way to do this? Is there a way to call a function
> with the new connection every time one is created by the engine?


sure - use 
http://www.sqlalchemy.org/docs/reference/sqlalchemy/interfaces.html?highlight=poollistener#sqlalchemy.interfaces.PoolListener

> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@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.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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