On Friday, October 6, 2017 at 7:23:45 AM UTC-4, Simon King wrote:
>
> Your code probably needs to do something like this: 
>
>     engine = sqlalchemy.create_engine(url, client_encoding='utf8') 
>     connection = engine.connect() 
>
> "engine.connect()" will raise an exception if it fails to connect. 
>

Expanding on Simon's answer, there is also some more detail on this in the 
connection-pooling docs: 
 http://docs.sqlalchemy.org/en/latest/core/pooling.html 

Depending on how you write this function, you may need to send something 
over the wire -- such as "SELECT 1;" -- just to ensure you're communicating 
with the DB properly if you are ever checking an existing connection.

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to