psycopg2.OperationalError: SSL SYSCALL error: EOF detected

Q:
psycopg2.OperationalError: SSL SYSCALL error: EOF detected
A:

exception psycopg2.OperationalError
Exception raised for errors that are related to the database’s
operation and not necessarily under the control of the programmer,
an unexpected disconnect occurs, the data source name is not
found, a transaction could not be processed, a memory allocation error
occurred during processing, etc.

an exception thrown for an error (not necessarily under programmer control) related to a database operation. An unexpected disconnect occurred, the data source name was not found, transactions could not be processed, memory allocation errors occurred during processing,
There are several possible causes of error reporting

1. Slow query
2. Process out of memory
3. Other queries are running, causing the table to be locked indefinitely
4. Insufficient disk space
5. Firewall

When the code successfully connected, but later an OperationalError occurred. Try to handle these broken connections in your code: the command to be executed is put into a try-catch block, and if the connection is broken, try to reconnect
Reference: https://stackoverflow.com/a/51764831/10051290

Read More: