Fix json issues (#5865)
parent
a0b8676f61
commit
5f52bb59dd
|
@ -374,7 +374,10 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
|
|||
if k in ('description',):
|
||||
data[k] = v
|
||||
else:
|
||||
data[k] = json.loads(v, cls=ColParamsJSONDecoder)
|
||||
try:
|
||||
data[k] = json.loads(v, cls=ColParamsJSONDecoder)
|
||||
except TypeError:
|
||||
data[k] = v
|
||||
|
||||
required_args = {
|
||||
'name': 'Name',
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue