Use ColumnElements instead of strings in migration
Using strings to reference columns in `select()` is no longer supported, and real ColumnElement objects should be used instead. Previously this was a warning, but now it is an error which breaks our database migrations with latest SQLAlchemy. This commit fixes the only place we do this in our code. Change-Id: I3134089525f76330c455fff83ab0ec90e4e20f0d
This commit is contained in:
parent
2e47430d54
commit
a2f0f207cd
@ -28,6 +28,7 @@ down_revision = '050'
|
||||
from alembic import op
|
||||
import json
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.sql import column
|
||||
from sqlalchemy.sql.expression import table
|
||||
|
||||
|
||||
@ -45,7 +46,7 @@ def upgrade(active_plugins=None, options=None):
|
||||
|
||||
stories_dict = {}
|
||||
for story in bind.execute(
|
||||
sa.select(columns=['id', 'title'],
|
||||
sa.select(columns=[column('id'), column('title')],
|
||||
from_obj=sa.Table('stories',
|
||||
sa.MetaData()))):
|
||||
stories_dict[story.id] = story.title
|
||||
|
Loading…
Reference in New Issue
Block a user