Task #7545
openReview SQLAlchemy vs Flask-SQLAlchemy consolidation options
0%
Description
Actually we have three methods of database model definition and access.
- Direct one for event database. We've already decided this doesn't change in #4628.
- Flask-SQLAlchemy and some direct SQLAlchemy(*) access within Hawat.
- Direct SQLAlchemy access(*) within Mentat - commandline tools and daemons.
Seems we could rewrite cmd utils to Flask CLI, benefiting from code simplification (probably even replacing/removing ZenScript parts of ZenKit). We would however still need some means to access Mentat configuration.
It might be harder for daemons (reporter for example).
So, the aim of this task is to review *SQLAlchemy usage, possibilities of consolidation (and removing the kludge to support both Hawat and Mentat apps) for informed decision and plan after.
Related issues
Updated by Jakub Judiny over 1 year ago
- Related to Support #7632: Mentat dependencies upgrade added
Updated by Jakub Judiny over 1 year ago
This article describes why it is good to use only SQLAlchemy with Flask, and not Flask-SQLAlchemy: https://towardsdatascience.com/use-flask-and-sqlalchemy-not-flask-sqlalchemy-5a64fafe22a4
Updated by Jakub Judiny over 1 year ago
- Related to Support #7642: Upgrade Flask-SQLAlchemy added
Updated by Jakub Judiny over 1 year ago
- Tracker changed from Support to Bug
- Status changed from New to In Progress
Updated by Jakub Judiny over 1 year ago
- Tracker changed from Bug to Task
- Status changed from In Progress to Deferred
Flask-SQLAlchemy is now only used in lib/hawat/db.py (which is used a lot in Hawat). It probably could be replaced with SQLAlchemy, but we decided it is not worth it for now. Advantages are insignificant and potential problems such as mistakes that would need futher fixes are likely, because Flask-SQLAlchemy handles some things for us, and we would need to start dealing with them explicitly.