File tree 2 files changed +15
-1
lines changed
2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ Release date: TBD
7
7
* Dropped support of end of life MySQL version 5.6
8
8
* Dropped support of end of life MariaDB versions below 10.3
9
9
* Dropped support of end of life Python version 3.6
10
+ * Fixed SSCursor raising OperationalError for query timeouts on wrong statement #1032
10
11
11
12
12
13
## v1.0.2
Original file line number Diff line number Diff line change @@ -1262,7 +1262,20 @@ def _finish_unbuffered_query(self):
1262
1262
# in fact, no way to stop MySQL from sending all the data after
1263
1263
# executing a query, so we just spin, and wait for an EOF packet.
1264
1264
while self .unbuffered_active :
1265
- packet = self .connection ._read_packet ()
1265
+ try :
1266
+ packet = self .connection ._read_packet ()
1267
+ except err .OperationalError as e :
1268
+ if e .args [0 ] in (
1269
+ ER .QUERY_TIMEOUT ,
1270
+ ER .STATEMENT_TIMEOUT ,
1271
+ ):
1272
+ # if the query timed out we can simply ignore this error
1273
+ self .unbuffered_active = False
1274
+ self .connection = None
1275
+ return
1276
+
1277
+ raise
1278
+
1266
1279
if self ._check_packet_is_eof (packet ):
1267
1280
self .unbuffered_active = False
1268
1281
self .connection = None # release reference to kill cyclic reference.
You can’t perform that action at this time.
0 commit comments