I'd augment the comments on the SO post by saying you'd want to look at 
psycopg2 directly, and possibly ask on their mailing list, what the expected 
behavior and options are here.  If you provide sample code to the psycopg2 
folks, make sure that code is in terms of psycopg2 directly and not any 
SQLAlchemy, lest they dismiss your issue as something specific to SQLAlchemy.




On Feb 24, 2012, at 3:47 PM, Cody Django wrote:

> Hi guys -- hopefully this is an easy answer for someone!  I've also
> posted the problem to stack overflow:
> http://stackoverflow.com/questions/9437498/sqlalchemy-stopping-a-long-running-query
> 
> 
> I'm using sqlalchemy to query postgres. If a client timeout occurs,
> I'd like to stop/cancel the long running postgres queries from another
> thread. The thread has access to the Session or Connection object.
> 
> At this point I've tried:
> 
> session.bind.raw_connection().close()
> and
> session.connection().close()
> and
> session.close
> and
> session.transaction.close()
> 
> But no matter what I try, the postgres query still continues until
> it's end. I know this from watching pg in top. Shouldn't this be
> fairly easy to do? I'm I missing something? Is this impossible without
> getting the pid and sending a stop signal directly?
> 
> Thanks so much,
> 
> Cody
> 
> -- 
> 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.
> 

-- 
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