venusaur022

导航

SQLAlchemy 2.0 新特性

orm-declarative-models

Migrating an Existing Mapping

Step one - declarative_base() is superseded by DeclarativeBase
Step two - replace Declarative use of Column with mapped_column()
Step three - apply exact Python types as needed using Mapped
Step four - remove mapped_column() directives where no longer needed
A mapped_column() directive with no parameters can be removed entirely.
fullname: Mapped[Optional[str]]

posted on 2023-03-21 10:53  妙蛙花  阅读(152)  评论(0编辑  收藏  举报