Change ORM models to dataclassess #273
Labels
No labels
Closed As
Duplicate
Closed As
Fixed
Closed As
Invalid
discussions
easyfix
enhancement
task
ai-review-please
Backlog Status
Needs Review
Backlog Status
Ready
chore
documentation
points
01
points
02
points
03
points
05
points
08
points
13
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Sprint Status
Blocked
Sprint Status
Done
Sprint Status
In Progress
Sprint Status
Review
Sprint Status
To Do
Technical Debt
Work Item
Bug
Work Item
Epic
Work Item
Spike
Work Item
Task
Work Item
User Story
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
quality/blockerbugs#273
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
SQLAlchemy 2.0 brought an option to use dataclasses as ORM models. That brings nice improvements, like not having to define
__init__()methods, possibly more accurate type hints, and more. See more documentation.Unfortunately, at this moment, it's not supported by Flask-SQLAlchemy, see this issue.
Once the issue is resolved, consider switching our ORM classes to dataclasses.
DeclarativeBase is now supported by a recent Flask-Sqlalchemy >= 3.1.0 release fyi.
Metadata Update from @kparal:
This is somewhat related to #306 and #317 - the mypy plugin is going away in SQLAlchemy 2.1 and for the purposes of type checking the tables need to be defined in a modern way:
https://docs.sqlalchemy.org/en/20/orm/extensions/mypy.html
https://docs.sqlalchemy.org/en/20/changelog/whatsnew_20.html#whatsnew-20-orm-declarative-typing