Hello,

So, short version: if I need a raw DBAPI connection and I have a SQLAlchemy Session, what's the correct way to manage that raw connection if I get it using session.connection().connection?

Versions:

Postgres 9.2
SQLAlchemy 0.8.2

Background:

I want to create a DataFrame using pandas.io.sql, but this requires a raw DBAPI connection while the rest of my app uses SQLAlchemy sessions. I bashed this in ipython notebook and ended up using session.connection().connection to get the raw connection.

Now, I'm abstracting some of my notebook experiments into library functions, and I found that unit testing a function that uses session.connection().connection causes a bunch of my other tests to fail even though all of my tests do a session.rollback() as part of the teardown.

What's the right way to get a raw connection? If it's session.connection().connection, what book-keeping do I need to do to stop stuff done in that connection not being rolled back by session.rollback()?

Side question: if session.connection() creates a new connection, how is stuff done in that connection not being isolate from stuff done in the session?

cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
            - http://www.simplistix.co.uk

--
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to