orator icon indicating copy to clipboard operation
orator copied to clipboard

orator.exceptions.query.QueryException: connection already closed

Open JahangerGull opened this issue 7 years ago • 2 comments

Hi

I am using orator db.connection to make an insert query, it works fine but after a while, it starts throwing "connection already closed" exception.

I dig out some code, and it looks like there are some string matching to find out the possible exception so it can reconnect in the following code:

https://github.com/sdispater/orator/blob/23daa78892ff5d1db8111bba098452248abc7ee4/orator/connections/connection.py#L346

But it looks like, the Postgres is having a different exception string "connection already closed", that does not exist there? Is that right or I am missing something else?

Here is the exception trace:

  File "/usr/local/lib/python3.5/dist-packages/orator/connections/co
nnection.py", line 236, in insert
    return self.statement(query, bindings)
  File "/usr/local/lib/python3.5/dist-packages/orator/connections/connection.py", line 34, in _run
    e, query, bindings, wrapped
  File "/usr/local/lib/python3.5/dist-packages/orator/connections/connection.py", line 341, in _try_again_if_caused_by_lost_connection
    raise QueryException(query, bindings, e)
orator.exceptions.query.QueryException: connection already closed

Thanks

JahangerGull avatar Jul 22 '18 21:07 JahangerGull

Any update on this issue? I'm having the same problem.

mirajehossain avatar May 05 '21 21:05 mirajehossain

I simply override this function and additional message for the Postgres connection close.

JahangerGull avatar May 05 '21 21:05 JahangerGull