Skip to content

Commit 24951aa

Browse files
committed
Move function from trigger/utils into module using it
1 parent c512cfe commit 24951aa

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

lib/galaxy/model/triggers/update_audit_table.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from galaxy.model.triggers.utils import execute_statements
1+
from sqlalchemy import DDL
22

33
# function name prefix
44
fn_prefix = "fn_audit_history_by"
@@ -174,3 +174,11 @@ def get_trigger_name(label, operation, when, statement=False):
174174
when_initial = when.lower()[0]
175175
rs = "s" if statement else "r"
176176
return f"trigger_{label}_{when_initial}{op_initial}{rs}"
177+
178+
179+
def execute_statements(engine, raw_sql):
180+
statements = raw_sql if isinstance(raw_sql, list) else [raw_sql]
181+
with engine.begin() as connection:
182+
for sql in statements:
183+
cmd = DDL(sql)
184+
connection.execute(cmd)

lib/galaxy/model/triggers/utils.py

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)