Open cainmagi opened 7 months ago
Happy to review a PR.
can i do ?
can i do ?
Well, I have already submitted the PR several months ago. That PR is still opened now. I do not think it is necessary to submit another one unless my PR is rejected for some reasons.
ok i will try another
Problem Description
The typehint of
should be
sq_orm.Relationship[...]
, notsq_orm.RelationshipProperty[...]
.The mismatch of the typehint causes the manual annotation supported by
sqlalchemy
fails:How to fix it
Go here: https://github.com/pallets-eco/flask-sqlalchemy/blob/42a36a3cb604fd39d81d00b54ab3988bbd0ad184/src/flask_sqlalchemy/extension.py#L953-L963
Make this modification:
Things will get corrected.
It is also recommended to modify this place:
https://github.com/pallets-eco/flask-sqlalchemy/blob/42a36a3cb604fd39d81d00b54ab3988bbd0ad184/src/flask_sqlalchemy/extension.py#L977-L979
But the following place should NOT be changed, because it is consistent with
sq_orm
: https://github.com/pallets-eco/flask-sqlalchemy/blob/42a36a3cb604fd39d81d00b54ab3988bbd0ad184/src/flask_sqlalchemy/extension.py#L965-L967Codes with typehint errors when using
flask-sqlalchemy
Codes working perfectly if only using
sqlalchemy
Environment:
3.10.13
3.1.1
2.0.28