You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sparse fields parameter for include causes pydantic error #101
thanks for the awesome project. most of the things I have tried are working - like magic! I did run into a few minor issues though. before diving into the code myself, perhaps you guys already have an idea of what might be the problem there.
this gives errors (one for each attribute besides 'naam' it seems):
[SQL: SELECT generiekproduct.verval_datum AS generiekproduct_verval_datum
FROM generiekproduct
WHERE generiekproduct.id = %s]
[parameters: [{'pk_1': 112615}]]
(Background on this error at: https://sqlalche.me/e/20/xd2s) [type=get_attribute_error, input_value=<model.Generiekproduct object at 0x751c74ac30e0>, input_type=Generiekproduct]
For further information visit https://errors.pydantic.dev/2.10/v/get_attribute_error
so it looks like pydantic expects the other attributes to still be there, even though only 'naam' comes from the database? (I see in another issue that you changed this recently - perhaps this is caused by not getting everything from the database anymore?)
happy to provide more information, or to try and create a test in your test set for this.
pydantic_core._pydantic_core.ValidationError: 2 validation errors for user_hidden_generationAttributesJSONAPI
E age
E Error extracting attribute: MissingGreenlet: greenlet_spawn has not been called; can't call await_only() here. Was IO attempted in an unexpected place? (Background on this error at: https://sqlalche.me/e/20/xd2s) [type=get_attribute_error, input_value=<examples.api_for_sqlalch...bject at 0x7c9d28f84440>, input_type=User]
E For further information visit https://errors.pydantic.dev/2.10/v/get_attribute_error
E email
E Error extracting attribute: MissingGreenlet: greenlet_spawn has not been called; can't call await_only() here. Was IO attempted in an unexpected place? (Background on this error at: https://sqlalche.me/e/20/xd2s) [type=get_attribute_error, input_value=<examples.api_for_sqlalch...bject at 0x7c9d28f84440>, input_type=User]
E For further information visit https://errors.pydantic.dev/2.10/v/get_attribute_error
Activity
srepmub commentedon May 9, 2025
the following test does something very similar, but it works:
test_api/test_api_sqla_with_includes.py::TestGetUsersList::test_select_custom_fields_with_includes
the difference seems to be that my test case includes a many-to-one relation, whereas this test case goes in the opposite direction.
when changing the test case to start from 'post' and include 'user' (so opposite direction) I get a similar pydantic error:
leading to: