On Tue, Jun 4, 2019, at 4:34 PM, Chris Withers wrote:
> On 04/06/2019 14:47, Mike Bayer wrote:
> > 
> > 
> > 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.
> 
> Okay, I must have missed that.
> 
> Just double checking: I thought you said that Session() would not block?
> If it's calling self.begin(), how come that isn't a blocking operation?


begin() is not blocking because it doesn't do anything with the engine or any 
connections, it just creates a new SessionTransaction object.

Looking at the source however it can block if you are using the session in 
autocommit mode, then add some pending objects, then say begin(), because it 
will flush on begin. So it depends a little bit how you are using the Session.





> 
> 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/9a6480f3-3c03-49cc-8d5a-f4143e215236%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to