Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
Flask-alchemy create Models

Hey Guys and Girls,

I´m wondering about a lot over Tutorials. I´m workin on my first little Flask Web App. I´m a student for Media Tech with intermediate or better good understanding whatsoever.

In many Tutorials this "Mapped" SQLALchemy 2.0 style just does not exist. Why is that? Is there any big difference?

The SQL ALchemy Tutorial tells me to use that style over the old style... I dont get it.

Or it is like Flask-alchemy is using the old style?

# SQL ALCHEMY 2.0 STYLE

class Base(DeclarativeBase):
    pass

db = SQLAlchemy(modelclass=Base)

class Sailor(Base):
    tablename = 'sailor'
    id: Mapped[int] = mapped
column(primarykey=True)
    username: Mapped[str] = mapped
column(String(50), nullable=False)
    password: Mappedstr = mappedcolumn(String(50), nullable=False)

#S SQL ALCHEMY OLD STYLE

class Sailor(db.base):
tablename = 'sailor'
id = db.Column(db.Integer, primary
key =

/r/flask
https://redd.it/1iac4im