aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornetworkjanitor <networkjanitor@xafy.de>2024-04-06 17:18:44 +0200
committernetworkjanitor <networkjanitor@xafy.de>2024-04-06 17:18:44 +0200
commit2790e3e34274ecce0e05753bd42b1ce6857e72e0 (patch)
tree89da7c019c465b455c92286c4ee3c0e449ce900f
parent4f96b9c3f39213a5f6ae631c7c820f63fc2219d5 (diff)
downloadfietsboek-2790e3e34274ecce0e05753bd42b1ce6857e72e0.tar.gz
fietsboek-2790e3e34274ecce0e05753bd42b1ce6857e72e0.tar.bz2
fietsboek-2790e3e34274ecce0e05753bd42b1ce6857e72e0.zip
fix(updater): add missing sqlalchemy.sql.text() to some migrations
-rw-r--r--fietsboek/updater/scripts/upd_20230103_lu8w3rwlz4ddcpms.py3
-rw-r--r--fietsboek/updater/scripts/upd_30ppwg8zi4ujb46f.py2
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)