Skip to content

autogenerate should resolve literal bind parameters #219

Closed
@sqlalchemy-bot

Description

@sqlalchemy-bot

Migrated issue, originally created by Lie Ryan (@lieryan)

Suppose that you have a table like this:

my_table = Table('my_table', metadata,
  Column('status', String(8), nullable=False),
)

status_list = ('statusA', 'statusB', 'statusC')
CheckConstraint(my_table.c.status.in_(status_list),           
  name='ck_my_table_status')

alembic autogenerate currently produces a create check constraint migration that looks like this:

sa.CheckConstraint('my_table.status IN (%(status_1)s, %(status_2)s, %(status_3)s)', name='ck_my_table_status')

I would expect autogenerate to resolve the placeholders when creating the constraints and produce something like:

sa.CheckConstraint('my_table.status IN ("statusA", "statusB", "statusC")', name='ck_my_table_status')

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions