aboutsummaryrefslogtreecommitdiff
path: root/app/func/remove_old_data.py
diff options
context:
space:
mode:
authorParker <contact@pkrm.dev>2024-02-26 20:55:05 -0600
committerParker <contact@pkrm.dev>2024-02-26 20:55:05 -0600
commitbce756b9aa51dfdfa2c2e6cdef4f88f660b80148 (patch)
treed2e7a238b04d4339bedf05f626bff15d48a61945 /app/func/remove_old_data.py
parenta0bfa5440603841c40e6a29495ca49c09a5d8c83 (diff)
Overhaul: Flask -> FastAPI
Diffstat (limited to 'app/func/remove_old_data.py')
-rw-r--r--app/func/remove_old_data.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/app/func/remove_old_data.py b/app/func/remove_old_data.py
index 7380fc5..96d08fa 100644
--- a/app/func/remove_old_data.py
+++ b/app/func/remove_old_data.py
@@ -17,7 +17,8 @@ def remove_old_data():
link = row.link
delete_links.append({'link': link})
- with engine.begin() as conn:
- conn.execute(sqlalchemy.text('DELETE FROM links WHERE link = :link'), delete_links)
- conn.execute(sqlalchemy.text('DELETE FROM records WHERE link = :link'), delete_links)
- conn.commit()
+ if delete_links:
+ with engine.begin() as conn:
+ conn.execute(sqlalchemy.text('DELETE FROM links WHERE link = :link'), delete_links)
+ conn.execute(sqlalchemy.text('DELETE FROM records WHERE link = :link'), delete_links)
+ conn.commit()