it's not unheard of that people sometimes do a quick ping, like : engine = create_engine(...) engine.scalar("select 1")
just to get it connected and initialized with server information. On Wed, Feb 21, 2018 at 6:26 AM, <jens.troe...@gmail.com> wrote: > Simon, thank you for the reference! That makes senseā¦ > > Jens > > > On Wednesday, February 21, 2018 at 7:15:20 PM UTC+10, Simon King wrote: >> >> SQLAlchemy doesn't connect to the database until it needs to. Creating >> a Session by itself does not cause it to connect. This is mentioned in >> the docs: >> >> http://docs.sqlalchemy.org/en/latest/orm/session_basics.html >> >> """ >> The Session begins in an essentially stateless form. Once queries are >> issued or other objects are persisted with it, it requests a >> connection resource from an Engine that is associated either with the >> Session itself or with the mapped Table objects being operated upon. >> This connection represents an ongoing transaction, which remains in >> effect until the Session is instructed to commit or roll back its >> pending state. >> """ >> >> Hope that helps, >> >> Simon > > -- > 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. > 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. For more options, visit https://groups.google.com/d/optout.