Skip to content

Commit 5230b36

Browse files
committed
Add mapped type annotation
1 parent 147d5c8 commit 5230b36

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from flask_migrate import Migrate as MigrateClass
88
from flask_sqlalchemy import SQLAlchemy
99
from sqlalchemy import text
10+
from sqlalchemy.orm import Mapped
1011
from sqlalchemy.orm.relationships import RelationshipProperty
1112
from werkzeug.wrappers import Response
1213

@@ -105,7 +106,7 @@ class Task(db.Model):
105106
user_id: int = db.Column(
106107
db.Integer, db.ForeignKey(User.__tablename__ + ".id")
107108
) # user id
108-
user = db.relationship(
109+
user: Mapped["User"] = db.relationship(
109110
"User", backref=db.backref("tasks", lazy=True)
110111
) # user relationship
111112

0 commit comments

Comments
 (0)