From 2790e3e34274ecce0e05753bd42b1ce6857e72e0 Mon Sep 17 00:00:00 2001 From: networkjanitor Date: Sat, 6 Apr 2024 17:18:44 +0200 Subject: fix(updater): add missing sqlalchemy.sql.text() to some migrations --- fietsboek/updater/scripts/upd_20230103_lu8w3rwlz4ddcpms.py | 3 ++- fietsboek/updater/scripts/upd_30ppwg8zi4ujb46f.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fietsboek/updater/scripts/upd_20230103_lu8w3rwlz4ddcpms.py b/fietsboek/updater/scripts/upd_20230103_lu8w3rwlz4ddcpms.py index 1630fbb..4362c2d 100644 --- a/fietsboek/updater/scripts/upd_20230103_lu8w3rwlz4ddcpms.py +++ b/fietsboek/updater/scripts/upd_20230103_lu8w3rwlz4ddcpms.py @@ -15,6 +15,7 @@ from pathlib import Path import brotli import gpxpy from sqlalchemy import create_engine +from sqlalchemy.sql import text from fietsboek.updater.script import UpdateScript @@ -37,7 +38,7 @@ class Up(UpdateScript): "FROM tracks, users " "WHERE tracks.owner_id = users.id;" ) - for row in connection.execute(sql): + for row in connection.execute(text(sql)): track_id, title, description, date_raw, date_tz, author_name = row if isinstance(date_raw, str): date_raw = datetime.datetime.strptime(date_raw, "%Y-%m-%d %H:%M:%S.%f") diff --git a/fietsboek/updater/scripts/upd_30ppwg8zi4ujb46f.py b/fietsboek/updater/scripts/upd_30ppwg8zi4ujb46f.py index 31ee9a0..e900c7a 100644 --- a/fietsboek/updater/scripts/upd_30ppwg8zi4ujb46f.py +++ b/fietsboek/updater/scripts/upd_30ppwg8zi4ujb46f.py @@ -28,7 +28,7 @@ class Up(UpdateScript): connection = engine.connect() data_dir = Path(config["fietsboek.data_dir"]) - for row in connection.execute("SELECT id, gpx FROM tracks;"): + for row in connection.execute(text("SELECT id, gpx FROM tracks;")): self.tell(f"Moving GPX data for track {row.id} from database to disk") track_dir = data_dir / "tracks" / str(row.id) track_dir.mkdir(parents=True, exist_ok=True) -- cgit v1.2.3