MCPcopy
hub / github.com/tortoise/tortoise-orm / _validate_rows

Function _validate_rows

tortoise/query_api.py:116–130  ·  view source on GitHub ↗
(rows: list[dict], schema: type[SchemaT] | Any)

Source from the content-addressed store, hash-verified

114
115
116def _validate_rows(rows: list[dict], schema: type[SchemaT] | Any) -> list[SchemaT]:
117 if not _PYDANTIC_AVAILABLE:
118 return cast(list[SchemaT], rows)
119
120 if _PydanticTypeAdapter is not None and isinstance(schema, _PydanticTypeAdapter):
121 return [cast(SchemaT, schema.validate_python(row)) for row in rows]
122
123 if (
124 _PydanticBaseModel is not None
125 and isinstance(schema, type)
126 and issubclass(schema, _PydanticBaseModel)
127 ):
128 return [cast(SchemaT, schema.model_validate(row)) for row in rows]
129
130 return cast(list[SchemaT], rows)

Callers 1

execute_pypikaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…