✨ Add PEP 593 support for Requirement annotations
see https://github.com/fastapi/sqlmodel/issues/229#issuecomment-2132852311
I'm not really sure how Pydantic does it, but here's a potential workaround to the problem.
@YuriiMotov I agree.
I'm not too familiar with this codebase. Can you point me to where I can write those tests?
I'm not too familiar with this codebase. Can you point me to where I can write those tests?
You can create an annotated version of the code example from "Relationships" section of docs:
- Go to https://github.com/fastapi/sqlmodel/tree/main/docs_src/tutorial/relationship_attributes/define_relationship_attributes
- Create a copy of
tutorial001_py310.py, call ittutorial001_an_py310.py - Edit code to follow the Annotated approach
- Go to https://github.com/fastapi/sqlmodel/tree/main/tests/test_tutorial/test_relationship_attributes/test_define_relationship_attributes
- Create a copy of
test_tutorial001_py310.py, call ittest_tutorial001_an_py310.py - Update code to import app from
tutorial001_an_py310.py - Push changes and check that new version of code example appeared in "Other versions and variants"
Heads-up: this will be closed in 3 days unless there’s new activity.
The test is failing with:
FAILED tests/test_tutorial/test_relationship_attributes/test_define_relationship_attributes/test_tutorial001_an_py310.py::test_tutorial - sqlalchemy.exc.ArgumentError: Mapper Mapper[Team(team)] could not assemble any primary key columns for mapped table 'team'
I'm not exactly sure how to approach this.
📝 Docs preview
Last commit 40af6901b885c2c80b164ca3c11c96c29f32d805 at: https://c0d7bffc.sqlmodel.pages.dev
The test is failing with:
FAILED tests/test_tutorial/test_relationship_attributes/test_define_relationship_attributes/test_tutorial001_an_py310.py::test_tutorial - sqlalchemy.exc.ArgumentError: Mapper Mapper[Team(team)] could not assemble any primary key columns for mapped table 'team'I'm not exactly sure how to approach this.
This is related to https://github.com/fastapi/sqlmodel/issues/1623 . I hope it will be fixed soon