using "postgresql.ARRAY(Unicode())" breaks automigrations #85
Comments
Michael Bayer (@zzzeek) wrote: we'd have to run type repr() generation through impl-specific hooks on this one, since a simple concatenation is not going to cut it in this case... |
Changes by Michael Bayer (@zzzeek):
|
Adam Gradzki wrote: when I have a model with ARRAY(TEXT), alembic incorrectly fails to expand TEXT to sa.TEXT() |
Andrei Mukhametvaleev (@Mukhametvaleev) wrote: This is not fixed yet? I have a same problem with some other field types in "postgresql.ARRAY()" |
Stavros Filargyropoulos (@sfilargi) wrote: Same here on postgresql.ARRAY() with String() vs sa.String() |
Andy Gan (@skavie) wrote: Same here on postgresql.JSON(astext_type=Text()) vs postgresql.JSON(astext_type=sa.Text()) Thanks Michael. |
aleksanb-td wrote: I encountered this bug in my project at work yesterday, and after a deep dive in the code i managed to find the correct search terms to find this issue. Relevant links for future people arriving in this issue tracker: There are two solutions for the concrete case with A third option is fixing the source itself, which will require changing the I tried looking at changing it myself, but without full architectural knowledge it would be a hack at best. |
Paul Brackin (@pbrackin) wrote: Had this with Integer type:
Patched it by editing the migration file, manually adding 'sa' like so:
|
Michael Bayer (@zzzeek) wrote: 5 years, 16 watchers, 10 votes, zero pull requests :(. Here is what "impl-specific hook" means:
|
Michael Bayer (@zzzeek) wrote: see also #411. We have a PR at zzzeek/alembic#38 which does the above architecture very nicely and I have to pull it into gerrit and get it ready to go. JSON/JSONB should also be pulled into it for #411. |
Michael Bayer (@zzzeek) wrote: Fix postgresql automigration for ARRAY types Adds a new codepath into render._repr_type() that will consult Co-authored-by: Mike Bayer mike_mp@zzzcomputing.com → f1cf86e |
Changes by Michael Bayer (@zzzeek):
|
Vladimir Goncharov (@AmatanHead) wrote: Hi! I'm able to reproduce this with 0.9.5. Is this fix released? My db model's code looks like this: from sqlalchemy import MetaData, Table, Column, types, schema, text
metadata = MetaData()
task = Table(
'task', metadata,
Column('id', types.Integer, primary_key=True),
Column('experiments', types.ARRAY(types.String), nullable=False),
...
) |
Migrated issue, originally created by Domen Kožar (@iElectric)
Because Unicode is undefined, alembic expects:
postgresql.ARRAY(sa.Unicode())
The text was updated successfully, but these errors were encountered: