jenkins-bot has submitted this change and it was merged.
Change subject: Keep alive connection to second MySQL database using Ping
......................................................................
Keep alive connection to second MySQL database using Ping
To avoid OperationalError: MySQL server has gone away
Bug: T117045
Change-Id: I2545a15602af883648299cca722ba6d5c1903550
---
M erfgoedbot/populate_image_table.py
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
Jean-Frédéric: Looks good to me, approved
jenkins-bot: Verified
diff --git a/erfgoedbot/populate_image_table.py
b/erfgoedbot/populate_image_table.py
index 3ffc122..639efe9 100644
--- a/erfgoedbot/populate_image_table.py
+++ b/erfgoedbot/populate_image_table.py
@@ -51,6 +51,7 @@
'''
conn = MySQLdb.connect('commonswiki.labsdb', db='commonswiki_p',
user=config.db_username, passwd=config.db_password,
use_unicode=True, charset='utf8')
+ conn.ping(True)
cursor = conn.cursor()
return (conn, cursor)
@@ -155,7 +156,7 @@
Update an entry for a single image
'''
query = u"""REPLACE INTO `image` (`country`, `id`, `img_name`) VALUES (%s,
%s, %s)"""
- with warnings.catch_warnings(record=True) as w:
+ with warnings.catch_warnings(record=True):
warnings.simplefilter("always")
cursor.execute(query, (countrycode, monumentId, name,))
--
To view, visit https://gerrit.wikimedia.org/r/277925
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I2545a15602af883648299cca722ba6d5c1903550
Gerrit-PatchSet: 1
Gerrit-Project: labs/tools/heritage
Gerrit-Branch: master
Gerrit-Owner: Jean-Frédéric <[email protected]>
Gerrit-Reviewer: Jean-Frédéric <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits