From 87486218bfe7049863d404baf69775a4c6e6ca86 Mon Sep 17 00:00:00 2001
From: Bjarke Madsen <bjarke@nordu.net>
Date: Tue, 21 Mar 2023 13:19:48 +0100
Subject: [PATCH] use sqlalchemy text for queries
---
compendium_v2/publishers/survey_publisher_2022.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/compendium_v2/publishers/survey_publisher_2022.py b/compendium_v2/publishers/survey_publisher_2022.py
index 9a432907..03bdbfa2 100644
--- a/compendium_v2/publishers/survey_publisher_2022.py
+++ b/compendium_v2/publishers/survey_publisher_2022.py
@@ -3,6 +3,7 @@ import click
import enum
import math
+from sqlalchemy import text
from compendium_v2.environment import setup_logging
from compendium_v2.config import load
from compendium_v2 import db, survey_db
@@ -60,7 +61,7 @@ def setup_db(config):
def transfer_budget():
with db.session_scope() as session, survey_db.session_scope() as survey:
- rows = survey.execute(BUDGET_QUERY)
+ rows = survey.execute(text(BUDGET_QUERY))
for row in rows:
nren = row['nren']
_budget = row['budget']
@@ -91,7 +92,7 @@ def transfer_funding_sources():
for source in FundingSource:
data = survey.execute(
- FUNDING_SOURCES_TEMPLATE_QUERY.format(source.value))
+ text(FUNDING_SOURCES_TEMPLATE_QUERY.format(source.value)))
for row in data:
nren = row['nren']
nrens.add(nren)
--
GitLab