On Tue, Jun 4, 2019, at 3:05 AM, Chris Withers wrote:
> Hi All,
> 
> What creates session.transaction? I can't spot get __getattr__ magic, 
> but the only place in the code I see it being created is in .begin(...), 
> which has a docstring saying that it should no longer be used, so I feel 
> like I must be missing something?


self.begin() is called inside the __init__ method of the Session when 
autocommit is at the default of False.

the reason you can't call it yourself with autocommit=False is that the Session 
keeps calling it automatically within each rollback() and commit().

which might seem weird but the SessionTransaction doesn't use any database 
resources for begin(), it's just a logical boundary.



> 
> cheers,
> 
> Chris
> 
> -- 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sqlalchemy/f0a290f1-6af6-01d5-2b45-c6dd72cc982b%40withers.org.
> 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 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/d5f9c027-98ab-491f-a7e4-da511810a123%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to