I have refactored the SQL Explorer functionality into its own blueprint (routes/sql_explorer.py) with a /sql URL prefix. This involved moving the relevant routes from app.py, registering the new blueprint, removing the old routes, updating url_for calls in the templates, and documenting the change in the changelog.

Here is a conventional commit message summarizing the changes:

```
feat: Refactor SQL Explorer into blueprint

- Moved SQL Explorer routes (view explorer, save/load/execute/delete queries, view schema, plot queries) from `app.py` into a new blueprint at `routes/sql_explorer.py`.
- Added `/sql` URL prefix to the blueprint.
- Registered the new `sql_explorer_bp` blueprint in `app.py`.
- Removed the original SQL Explorer route definitions from `app.py`.
- Updated `url_for` calls in relevant templates (`sql_explorer.html`, `partials/sql_explorer/sql_query.html`, `base.html`) to reference the new blueprint endpoints (e.g., `sql_explorer.sql_explorer`).
- Updated `templates/changelog/changelog.html` to document this refactoring.
```
This commit is contained in:
Peter Stockings
2025-03-31 23:00:54 +11:00
parent eaeb4ab2c8
commit a8fe28339b
8 changed files with 248 additions and 288 deletions

2
db.py
View File

@@ -10,7 +10,6 @@ from features.exercises import Exercises
from features.people_graphs import PeopleGraphs
from features.person_overview import PersonOverview
from features.stats import Stats
from features.sql_explorer import SQLExplorer
from features.dashboard import Dashboard
from utils import get_exercise_graph_model
@@ -19,7 +18,6 @@ class DataBase():
def __init__(self, app=None):
self.stats = Stats(self.execute)
self.exercises = Exercises(self.execute)
self.sql_explorer = SQLExplorer(self.execute)
self.person_overview = PersonOverview(self.execute)
self.people_graphs = PeopleGraphs(self.execute)
self.dashboard = Dashboard(self.execute)