Jonathan: Thanks for your reply. After perusing the link you provided, I'll give begin_nested a try.
And you're quite right, its probably not pyramid_tm so much as the zope.sqlalchemy. But truthfully, I don't know why it is happening. The prior bulk insert pattern using sess.add_all worked fine, but upsert is the right thing to do here. I'll give begin_nested a try and post back. Thanks again, Richard On Wednesday, June 28, 2017 at 1:43:22 PM UTC-6, Jonathan Vanasco wrote: > > > >> On Wednesday, June 28, 2017 at 3:16:52 PM UTC-4, Richard Rosenberg wrote: >> > > On Wednesday, June 28, 2017 at 3:16:52 PM UTC-4, Richard Rosenberg wrote: >> >> >> I am absolutely puzzled, but it seems likely that pyramid_tm is in the >> way somehow. It always wants to do its own thing, and calling commit >> explicitly is something it seems to abhor. My next step is to wrap this in: >> >> with transaction.manager as tx: >> >> But this is really not what I want. I'm tempted to rip out all of the >> zopish stuff and go with SQLA's session, but before I try that, I thought >> it might be worthwhile to get some further information. >> >> > For a quick-fix, i'd try to run this bit within a nested > transaction/savepoint: > > http://docs.sqlalchemy.org/en/latest/orm/session_transaction.html > > > I doubt the problem is in `pyramid_tm`. that package just wraps the > request in some logic to hook into the transaction package; all the real > work is done by `zope.sqlalchemy`. The issue is possibly linked to your > version of `zope.sqlalchemy` or `pyscopg2` (or other driver). I'd try to > update those... but from what I see here, you could probably just dump this > into a nested transaction, which will limit the scope of the rollback. > > > -- 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.