Fix json issues (#5865)

This commit is contained in:
Khushboo Vashi
2023-02-16 16:16:39 +05:30
committed by GitHub
parent a0b8676f61
commit 5f52bb59dd
3 changed files with 10 additions and 4 deletions

View File

@@ -27,7 +27,12 @@ class DataTypeJSONEncoder(json.JSONEncoder):
if isinstance(obj, decimal.Decimal):
return float(obj)
return json.JSONEncoder.default(self, obj)
try:
retval = json.JSONEncoder.default(self, obj)
except TypeError:
retval = obj
return retval
class ColParamsJSONDecoder(json.JSONDecoder):

View File

@@ -1987,8 +1987,6 @@ Failed to reset the connection to the server due to following error:
if parameters:
mogrified_sql = cursor.mogrify(query, parameters)
if isinstance(mogrified_sql, bytes):
mogrified_sql = mogrified_sql.decode(self.python_encoding)
return mogrified_sql
else:
return query