Yes, this is perfect. Thanks. On Tuesday, April 1, 2014 5:52:26 PM UTC-5, Michael Bayer wrote: > > > On Apr 1, 2014, at 6:07 PM, [email protected] <javascript:> wrote: > > > So I have an ORM session that I've called session.begin() on to start a > transaction. > > > > I found from some other posts that I can get access to postgres COPY > command via psycopg2's copy_from method. > > > > So a simple test case for my code looks something like this: > > > > session.begin() > > session.execute("CREATE SCHEMA data"); > > cursor = session.bind.raw_connection().cursor() > > cursor.copy_from(open("data.raw", "data.table1")) > > > > The problem I'm having is that the CREATE SCHEMA command was created in > the transaction, and the cursor that > > I'm trying to use copy_from does not contain state from that > transaction. > > > get the cursor like this: > > conn = session.connection() # SQLAlchemy Connection > dbapi_conn = conn.connection # DBAPI connection (technically a connection > pool wrapper called ConnectionFairy, but everything is there) > cursor = dbapi_conn.cursor() # actual DBAPI cursor > > >
-- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
