Re: [sqlalchemy] Session.query vs Session().query when session is a scoped_session

41 views
Skip to first unread message

Mike Bayer

unread,
Feb 27, 2021, 6:43:54 PM2/27/21
to noreply-spamdigest via sqlalchemy
There's no difference, but for the best patterns i would instantiate the Session before using it.  Modern Session usage in the upcoming 1.4.0 release looks like what you see at https://docs.sqlalchemy.org/en/14/orm/session_basics.html#opening-and-closing-a-session

On Sat, Feb 27, 2021, at 1:31 AM, M wrote:
Hello,

I would like your opinion regarding this stackoverflow question

I would like to know if the selected answer is correct/accurate. 
Is there no difference between Session.query vs Session().query when using scoped_session ?

And which one should be preferred ?

Regards,
M


--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
 
 
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+...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages