From 56853787e7d073c8b15f34dcc949b9f67e1dc975 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 26 Jun 2020 11:45:40 -0500 Subject: [PATCH] Fix repack when using pymysql (#37142) --- homeassistant/components/recorder/purge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/recorder/purge.py b/homeassistant/components/recorder/purge.py index 833926af219..8b0b71e24ae 100644 --- a/homeassistant/components/recorder/purge.py +++ b/homeassistant/components/recorder/purge.py @@ -76,7 +76,7 @@ def purge_old_data(instance, purge_days: int, repack: bool) -> bool: _LOGGER.debug("Vacuuming SQL DB to free space") instance.engine.execute("VACUUM") # Optimize mysql / mariadb tables to free up space on disk - elif instance.engine.driver == "mysqldb": + elif instance.engine.driver in ("mysqldb", "pymysql"): _LOGGER.debug("Optimizing SQL DB to free space") instance.engine.execute("OPTIMIZE TABLE states, events, recorder_runs")