pymysql.err.InterfaceError after some hours of usage

Inada Naoki songofacandy at gmail.com
Wed Oct 2 12:11:22 EDT 2019


2019年10月3日(木) 0:56 Νίκος Βέργος <vergos.nikolas at gmail.com>:

> Τη Τετάρτη, 2 Οκτωβρίου 2019 - 8:26:38 π.μ. UTC+3, ο χρήστης Inada Naoki
> έγραψε:
> > MySQL connection can be closed automatically by various reasons.
> > For example, `wait_timeout` is the most common but not only reason for
> > closing the connection.
> >
> > You should connect and close MySQL connection for each HTTP request.
> >
> > Or you can use more smart connection pool (e.g. Engine in SQLAlchemy).
> > It provides `pool_recycle` and `pool_pre_ping` options.
> >
> > https://docs.sqlalchemy.org/en/13/core/pooling.html#setting-pool-recycle
>
> You mean that every time i insrt/update and in general having a
> cur.execute() i then need to close the pymysql connection in order to not
> have this error?
>

No, I meant one new DB connection for each HTTP request, not for each DB
query.

-- 
> https://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list