Skip to content

Commit bf3b64a

Browse files
Update models.py
1 parent a5e8ca2 commit bf3b64a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
from sqlalchemy import Column, Integer, String
2-
from sqlalchemy.ext.declarative import declarative_base
1+
from sqlalchemy.orm import DeclarativeBase, Mapped
32

4-
Base = declarative_base()
3+
class Base(DeclarativeBase):
4+
"""Base for models."""
55

66

77
class World(Base):
88
__tablename__ = 'world'
9-
id = Column(Integer, primary_key=True)
10-
randomnumber = Column(Integer)
9+
id: Mapped[int] = mapped_column(primary_key=True)
10+
randomnumber: Mapped[int]
1111

1212
sa_worlds = World.__table__
1313

1414

1515
class Fortune(Base):
1616
__tablename__ = 'fortune'
17-
id = Column(Integer, primary_key=True)
18-
message = Column(String)
17+
id: Mapped[int] = mapped_column(primary_key=True)
18+
message: Mapped[str]
1919

2020
sa_fortunes = Fortune.__table__

0 commit comments

Comments
 (0)