Project

General

Profile

Actions

Task #7545

open

Review SQLAlchemy vs Flask-SQLAlchemy consolidation options

Added by Pavel Kácha over 2 years ago. Updated 11 months ago.

Status:
Deferred
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
01/06/2022
Due date:
% Done:

0%

Estimated time:
To be discussed:
No

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

Related to Mentat - Support #7632: Mentat dependencies upgradeClosedJakub Judiny02/28/2023

Actions
Related to Mentat - Support #7642: Upgrade Flask-SQLAlchemyClosedJakub Judiny04/13/2023

Actions
Actions #1

Updated by Jakub Judiny about 1 year ago

Actions #2

Updated by Jakub Judiny about 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

Actions #3

Updated by Jakub Judiny about 1 year ago

Actions #4

Updated by Jakub Judiny 12 months ago

  • Assignee set to Jakub Judiny
Actions #5

Updated by Jakub Judiny 11 months ago

  • Tracker changed from Task to Support
Actions #6

Updated by Jakub Judiny 11 months ago

  • Tracker changed from Support to Bug
  • Status changed from New to In Progress
Actions #7

Updated by Jakub Judiny 11 months 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.

Actions

Also available in: Atom PDF