Hi there -
not able to reproduce.
Using the following migration script:
"""rev1
Revision ID: 71b85e1758dc
Revises:
Create Date: 2017-03-25 22:22:35.731821
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '71b85e1758dc'
down_revision = None
branch_labels = None
depends_on = None
from sqlalchemy.dialects.postgresql import ENUM
def upgrade():
connector_types = op.create_table('ConnectorTypes',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('description', sa.String(length=255), nullable=True),
sa.Column('type', ENUM(u'MODBUS', u'BACNET', u'SNTP', u'SYSLOG',
u'IPTV', name='connector_type'), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint('id')
)
# insert connector types
op.bulk_insert(connector_types, [
{'description': '', 'type': 'MODBUS'},
{'description': '', 'type': 'BACNET'},
{'description': '', 'type': 'SNTP'},
{'description': '', 'type': 'SYSLOG'},
{'description': '', 'type': 'IPTV'},
])
def downgrade():
pass
run it, log into Postgresql:
test=# select * from "ConnectorTypes";
id | description | type
----+-------------+--------
1 | | MODBUS
2 | | BACNET
3 | | SNTP
4 | | SYSLOG
5 | | IPTV
(5 rows)
I would advise setting the debug level for "sqlalchemy.engine" in your
alembic.ini to INFO or DEBUG and watch the SQL emitted. It should look
like:
INSERT INTO "ConnectorTypes" (description, type) VALUES
(%(description)s, %(type)s)
INFO [sqlalchemy.engine.base.Engine] ({'type': u'MODBUS',
'description': ''}, {'type': u'BACNET', 'description': ''}, {'type':
u'SNTP', 'description': ''}, {'type': u'SYSLOG', 'description': ''},
{'type': u'IPTV', 'description': ''})
Note that since your table name is "ConnectorTypes", containing at least
one upper case character, this a case sensitive name. If you have
another table called "connectortypes", that's a *different* table. Make
sure that's not creating confusion.
> --
> You received this message because you are subscribed to the Google
> Groups "sqlalchemy-alembic" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
sqlalchemy-alem...@googlegroups.com
> <mailto:
sqlalchemy-alem...@googlegroups.com>.
> For more options, visit
https://groups.google.com/d/optout.