Hello,
I tried now and it worked - very strange since I was debugging at Saturday
more than 5 hours and kept displaying NULL. Thank you very much for your
help!
Best regards
On Sunday, March 26, 2017 at 12:37:21 PM UTC+2, Nikola Radovanovic wrote:
>
> Hi, thank you for quick response - I will try again. Maybe my UI tool was
> giving me bad output since I did not see any error while inserting and
> while debugging I saw statement similar to yours. Will report back.
>
> best regards
>
> On Saturday, March 25, 2017 at 2:37:29 PM UTC+1, Nikola Radovanovic wrote:
>>
>> Hello,
>> I need help; google search and trial-and-error did not do me any good
>> also.
>>
>> I cant figure out how to populate DB table with ENUM values during
>> migration using bulk_insert. to be more precise, NULL values are inserted
>> instead of proper strings. I can insert using plain SQL from DB UI tools
>> (DBeaver), tried same SQL in alembic script - still not working.
>>
>> Maybe this what I currently have is not the best approach, so feel free
>> to point me into right direction. DB is Postgres and here is the relevant
>> code
>>
>> # model
>> class ConnectorType(Base):
>> __tablename__ = 'ConnectorTypes'
>>
>> id = Column(Integer, primary_key=True)
>> description = Column(String(255))
>> type = Column(ENUM('MODBUS', 'BACNET', 'SNTP', 'SYSLOG', 'IPTV',
>> name='connector_type'))
>>
>> # alembic
>> 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'},
>> ])
>>
>>
>> Thank you in advance.
>>
>>
>>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.