Optimize the serialize return of SQLA select (#436)

This commit is contained in:
Wu Clan
2024-10-10 12:11:05 +08:00
committed by GitHub
parent c22d1394e7
commit a3d079cfdf

View File

@@ -57,7 +57,6 @@ def select_as_dict(row: R, use_alias: bool = False) -> dict:
result = row.__dict__
if '_sa_instance_state' in result:
del result['_sa_instance_state']
return result
else:
result = {}
mapper = class_mapper(row.__class__)
@@ -65,7 +64,8 @@ def select_as_dict(row: R, use_alias: bool = False) -> dict:
if isinstance(prop, (ColumnProperty, SynonymProperty)):
key = prop.key
result[key] = getattr(row, key)
return result
return result
class MsgSpecJSONResponse(JSONResponse):