Answer the question
In order to leave comments, you need to log in
How do I resolve the sqlalchemy.exc.OperationalError when connecting to AWS RDS?
The sqlalchemy connection to the mysql database in AWS RDS is lost while running the program.
The error occurs after 10-15 minutes of idle time of the program.
sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2013, 'Lost connection to MySQL server during query ([WinError 10060] Попытка установить соединение была безуспешной, т.к. от другого компьютера за требуемое время не получен нужный отклик, или было разорвано уже установленное соединение из-за неверного отклика уже подключенного компьютера)')
engine = create_engine(
'mysql+pymysql://admin:***"***rds.amazonaws.com:3306/***',
echo=True,
pool_recycle=3599)
Session = sessionmaker(bind=engine)
session = Session()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question