Repository navigation
How to map query results to objects? #1315
First Check
Commit to Help
Example CodeDescriptionSupposed that I have 2 models, The I know that I can do it manually by looping through the Operating SystemmacOS Operating System DetailsNo response SQLModel Version0.0.22 Python Version3.11.4 Additional ContextNo response |
Answered by
YuriiMotov
Aug 21, 2025
Replies: 1 comment 3 replies
|
Validate res = [QueryResult.model_validate({"full_name": row[0], "person_age": row[1]} for row in results)] |
3 replies
Answer selected by
YuriiMotov
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Validate
resultswithQueryResultmodel.Something like