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 > <https://stackoverflow.com/questions/39750373/difference-between-sqlalchemy-scoped-session-and-scoped-session> > > 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 > > 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 view this discussion on the web visit > https://groups.google.com/d/msgid/sqlalchemy/eabd8eae-d2e8-48bf-a99c-b69ffed7fedan%40googlegroups.com > > <https://groups.google.com/d/msgid/sqlalchemy/eabd8eae-d2e8-48bf-a99c-b69ffed7fedan%40googlegroups.com?utm_medium=email&utm_source=footer>. -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/df5477d1-b313-402e-ad90-7963c0c315ef%40www.fastmail.com.
