We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 900900b commit f3fb377Copy full SHA for f3fb377
functions/sql/mysql_sample.py
@@ -46,11 +46,9 @@ def __get_cursor():
46
PyMySQL does NOT automatically reconnect,
47
so we must reconnect explicitly using ping()
48
"""
49
- try:
50
- return mysql_conn.cursor()
51
- except OperationalError:
+ if not mysql_conn.open:
52
mysql_conn.ping(reconnect=True)
53
+ return mysql_conn.cursor()
54
55
56
def mysql_demo(request):
0 commit comments