mirror of
https://github.com/fastapi-practices/fastapi-best-architecture.git
synced 2026-09-21 13:12:24 +00:00
Update return schema of query interface (#492)
* Update return model of query interface * Update tree data return type hints * Update code generation and task return types * Fix inconsistency between ORM query result and schema
This commit is contained in:
@@ -30,7 +30,7 @@ def select_columns_serialize(row: R) -> dict:
|
||||
return result
|
||||
|
||||
|
||||
def select_list_serialize(row: Sequence[R]) -> list:
|
||||
def select_list_serialize(row: Sequence[R]) -> list[dict[str, Any]]:
|
||||
"""
|
||||
Serialize SQLAlchemy select list
|
||||
|
||||
@@ -59,7 +59,7 @@ def select_as_dict(row: R, use_alias: bool = False) -> dict:
|
||||
del result['_sa_instance_state']
|
||||
else:
|
||||
result = {}
|
||||
mapper = class_mapper(row.__class__)
|
||||
mapper = class_mapper(row.__class__) # type: ignore
|
||||
for prop in mapper.iterate_properties:
|
||||
if isinstance(prop, (ColumnProperty, SynonymProperty)):
|
||||
key = prop.key
|
||||
|
||||
Reference in New Issue
Block a user