On 12/09/2016 04:18 PM, Jonathan Vanasco wrote:
I ran into an issue when transitioning a scoped session to a regular
session in an application.
A block of code had previously created a secondary session (to the same
database) to autocommit some data outside of the session/transaction:
dbSessionAutocommit = dbSession.session_factory(autocommit = True)
... do something ...
dbSessionAutocommit.flush()
dbSessionAutocommit.close()
this broke on transition, as the non-scoped session doesn't have a
`session_factory` method.
going through the documentation, there's nothing in the
API/narrative/faq that seems to correspond with my needs (new session,
same engine, different connection; only different is in autocommit)
does anyone have a clue on how I could build a new session?
dbSession.__class__(autocommit=True) won't work, as it won't have a
configured engine.
you have just a plain Session? why can't you carry along the
sessionmaker from your scoped session ? the point of sessionmaker is
to hold onto configuration options.
--
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 [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.