MySQL Connection not available | Python Telegram API | Heroku

def db_add_country(Country):
    mycursor = mydb.cursor(buffered=True)
    mycursor.execute("UPDATE `country` SET `country` = %s WHERE `country`.`id` = 1", (Country,))
    mydb.commit()


def db_read_country():
    mycursor = mydb.cursor(buffered=True)
    mycursor.execute("SELECT * FROM `country`")
    row = mycursor.fetchone()
    return row[1]


def poses():
    mycursor = mydb.cursor(buffered=True)
    mycursor.execute("SELECT * FROM `poses`")
    pose = mycursor.fetchone()
    mycursor.execute("DELETE FROM `poses` WHERE `photo` = %s", (pose[1],))
    bot.send_message(USER_ID, pose[1])
    bot.send_message(USER_ID, pose[2])
    mydb.commit()

Если использовать poses после двух верхних вылазит такая ошибка:

2020-02-08T19:30:00.016059+00:00 app[worker.1]:   File "bot.py", line 46, in poses
2020-02-08T19:30:00.016059+00:00 app[worker.1]:     mycursor = mydb.cursor(buffered=True)
2020-02-08T19:30:00.016060+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/mysql/connector/connection_cext.py", line 541, in cursor
2020-02-08T19:30:00.016060+00:00 app[worker.1]:     raise errors.OperationalError("MySQL Connection not available.")
2020-02-08T19:30:00.016061+00:00 app[worker.1]: mysql.connector.errors.OperationalError: MySQL Connection not available.

Ответы (0 шт):