-
-
Notifications
You must be signed in to change notification settings - Fork 901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type (typehint) error for db.relationship
#1318
Comments
Happy to review a PR. |
cainmagi
added a commit
to cainmagi/flask-sqlalchemy
that referenced
this issue
Mar 26, 2024
Fix the typehint inconsistence of `db.relationship(...)`.
6 tasks
cainmagi
added a commit
to cainmagi/flask-sqlalchemy
that referenced
this issue
Mar 26, 2024
Fix the typehint inconsistence of `db.relationship(...)`.
cainmagi
added a commit
to cainmagi/flask-sqlalchemy
that referenced
this issue
Mar 26, 2024
Make the typehint of `SQLAlchemy.relationship` consistent with `sqlalchemy.orm.relationship`.
6 tasks
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
flask-sqlalchemy/src/flask_sqlalchemy/extension.py
Lines 953 to 963 in 42a36a3
Make this modification:
Things will get corrected.
It is also recommended to modify this place:
flask-sqlalchemy/src/flask_sqlalchemy/extension.py
Lines 977 to 979 in 42a36a3
But the following place should NOT be changed, because it is consistent with
sq_orm
:flask-sqlalchemy/src/flask_sqlalchemy/extension.py
Lines 965 to 967 in 42a36a3
Codes with typehint errors when using
flask-sqlalchemy
Codes working perfectly if only using
sqlalchemy
Environment:
3.10.13
3.1.1
2.0.28
The text was updated successfully, but these errors were encountered: