Thank you Jonathan! I checked if my celery_state_session had been mistakenly connected to zope.sqlalchemy as I am using pyramid_celery. I didn't find anything. On the other hand, `domain_model_session` is wired to transaction.manager by zope.sqlalchemy (zope.sqlalchemy.registry()).
I even tried creating the engine `eng` and `celery_state_session` step by step: > > from .models import get_engine > from sqlalchemy.orm import sessionmaker > settings = self.app.conf["PYRAMID_REGISTRY"].settings > eng = get_engine(settings) > eng.update_execution_options(autocommit=True, autoflush=False) > factory = sessionmaker() > factory.configure(bind=eng) > celery_state_session = factory() > > Nothing - same "incorrect" behavior :( Maybe the `domain_model_session` being wired to transaction.manager and threadlocal is affecting the behavior of my `celery_state_session`? > > On Thursday, June 21, 2018 at 9:34:33 PM UTC-5, Jonathan Vanasco wrote: > > > On Thursday, June 21, 2018 at 10:02:27 PM UTC-4, HP3 wrote: >> >> What's the correct way to create a session that is not automatically >> bound to any transaction or that can be explicitly bound to an isolated >> transaction that can be committed whenever? >> > > That's what `Session()` does by default > > Usually arguments to the Engine/Session configuration or framework plugins > are used to bind sessions to active transactions (such as > zope.sqlalchemy). You probably have code that is doing that, somewhere. > -- 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.