Skip to content

Commit

Permalink
text wrapper on sql statement
Browse files Browse the repository at this point in the history
  • Loading branch information
silil committed Sep 24, 2024
1 parent 6ff053b commit c55adb7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/triage/component/results_schema/alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
import yaml
import re
from alembic import context
from sqlalchemy import create_engine
from sqlalchemy import pool
from sqlalchemy import create_engine, pool, text
from sqlalchemy.engine.url import URL
import verboselogs, logging
logger = verboselogs.VerboseLogger(__name__)

from triage.component.results_schema import Base

Expand Down Expand Up @@ -113,7 +114,7 @@ def run_migrations_online():
and associate a connection with the context.
"""

logging.info(f"run_migrations_online url {url}")
connectable = create_engine(url, poolclass=pool.NullPool)

with connectable.connect() as connection:
Expand All @@ -124,7 +125,7 @@ def run_migrations_online():
include_schemas=True,
include_object=include_object,
)
connection.execute('set search_path to "{}", public'.format("results"))
connection.execute(text('set search_path to "{results}", public'))

with context.begin_transaction():
context.run_migrations()
Expand Down

0 comments on commit c55adb7

Please sign in to comment.