From 384da2487abca71368227369055d46e613ada439 Mon Sep 17 00:00:00 2001 From: Phanindra899 Date: Fri, 27 Mar 2026 17:34:36 +0530 Subject: [PATCH 1/2] Replace engine.connect() with engine.begin() in util.py Signed-off-by: Phanindra899 --- collectoss/api/routes/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collectoss/api/routes/util.py b/collectoss/api/routes/util.py index aeaa2e602..bb303183d 100644 --- a/collectoss/api/routes/util.py +++ b/collectoss/api/routes/util.py @@ -27,7 +27,7 @@ def get_all_repo_groups(): #TODO: make this name automatic - wrapper? ORDER BY rg_name """) - with current_app.engine.connect() as conn: + with current_app.engine.begin() as conn: results = pd.read_sql(repoGroupsSQL, conn) data = results.to_json(orient="records", date_format='iso', date_unit='ms') return Response(response=data, From 6c7390103a70869bc6c86dd771e0f72ceca49c2b Mon Sep 17 00:00:00 2001 From: Phanindra899 Date: Sat, 28 Mar 2026 22:12:54 +0530 Subject: [PATCH 2/2] Use engine.begin() for DELETE operation and revert incorrect change on read-only query Signed-off-by: Phanindra899 --- collectoss/api/routes/util.py | 2 +- collectoss/tasks/data_analysis/insight_worker/tasks.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/collectoss/api/routes/util.py b/collectoss/api/routes/util.py index bb303183d..aeaa2e602 100644 --- a/collectoss/api/routes/util.py +++ b/collectoss/api/routes/util.py @@ -27,7 +27,7 @@ def get_all_repo_groups(): #TODO: make this name automatic - wrapper? ORDER BY rg_name """) - with current_app.engine.begin() as conn: + with current_app.engine.connect() as conn: results = pd.read_sql(repoGroupsSQL, conn) data = results.to_json(orient="records", date_format='iso', date_unit='ms') return Response(response=data, diff --git a/collectoss/tasks/data_analysis/insight_worker/tasks.py b/collectoss/tasks/data_analysis/insight_worker/tasks.py index 4bbcc3ed5..123407c58 100644 --- a/collectoss/tasks/data_analysis/insight_worker/tasks.py +++ b/collectoss/tasks/data_analysis/insight_worker/tasks.py @@ -106,7 +106,7 @@ def insight_model(repo_git: str,logger,engine) -> None: AND ri_date < :min_date """) - with engine.connect() as conn: + with engine.begin() as conn: result = conn.execute(delete_record_SQL, parameters=dict(repo_id=repo_id, min_date=min_date)) logger.info("Deleting out of date data points ...\n")