Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

add reconnect=1 parameter to mysql_connect in order to reconnect after a large inactivity period

olveyra7fc59232495a
diff --git a/scrapy/trunk/scrapy/utils/db.py b/scrapy/trunk/scrapy/utils/db.py
index 274b0f4e7..ea91e6ddc 100644
--- a/scrapy/trunk/scrapy/utils/db.py
+++ b/scrapy/trunk/scrapy/utils/db.py
@@ -18,5 +18,6 @@ def mysql_connect(db_uri, **kwargs):
del(d['passwd'])
d['charset'] = "utf8"
+ d['reconnect'] = 1
d.update(kwargs)
return MySQLdb.connect(**d)