1. Mike Bayer
  2. alembic


Issue #138 resolved

mysql SET

Tomasz Święcicki
created an issue

I have column like:

test = db.Column(
    mysql.SET('t1', 't2', 't3'), default='t1,t2,t3', nullable=False

then after autogenerate I got this:

op.add_column('target_set_location_country', sa.Column('test', mysql.SET('t1', 't2', 't3'), nullable=False))

It's strange because alembic should generate:

mysql.SET("'t1'", "'t2'", "'t3'")

SQL (doesn't work):

source SET(t1,t2,t3) DEFAULT 't1,t2,t3' NOT NULL,

SQL (correct):

source SET('t1','t2','t3') DEFAULT 't1,t2,t3' NOT NULL,

So, after autogenerate I have to change this manually. I tried to add ' to models, but it does not worked.

Comments (2)

  1. Mike Bayer repo owner

    OK well a fix for this would just be the __repr__ for SET, the problem here is with SET itself in that for backwards compatibility it requires those quotes. that's on the SQLAlchemy side, and in fact a better solution is to make the quotes optional, that's now http://www.sqlalchemy.org/trac/ticket/2817. for now you can specify a user defined render function.

  2. Log in to comment