longshot, i know.

We've got some legacy twisted code that does raw operations via a 
twisted.enterprise.adbapi connection pool with the psycopg2 driver.  Other 
services in this deployment are configured to use SqlAlchemy for all 
operations - this is the legacy holdout.

There are a few chunks of blocking code that have a performance bottleneck 
caused by multiple updates to the same records.  

I'm wondering if it's possible to leverage the orm on top of this existing 
connection's cursor.  The basic idea would be this:

   s = Session(connection=twisted_dbapi_cursor)
   foo = s.query(Foo).get()
   s.flush()
   txn.commit()
   s.close()
   
I've seen stuff about using an engine build off an existing connection, but 
I only have the cursor - not the connection itself.  The connection is a 
private attribute in the cursor, so i could potentially access it.... but 
that could cause issues that scare me at this point.

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to