def clear_column_type(cls, column_type=''):
if column_type:
column_type = column_type.split(') ')
l = len(column_type)
column_type = column_type[0]
if l:
if l > 1:
column_type = '{})'.format(column_type)
column_type = 'sa.{}'.format(column_type)
if 'INTEGER' in column_type or 'TINYINT' in column_type\
or 'BIGINT' in column_type:
column_type = 'sa.Integer()'
if 'string' in column_type:
column_type = 'sa.Text()'
if 'OBJECT' in column_type:
column_type = 'sa.Text()'
if 'DATETIME' in column_type or 'TIMESTAMP WITHOUT TIME ZONE' \
in column_type or 'TIMESTAMP WITH TIME ZONE'\
in column_type:
column_type = 'sa.DateTime()'
if 'HSTORE' in column_type:
# column_type = 'postgresql.HSTORE(text_type=sa.Text())'
column_type = 'postgresql.HSTORE'
else:
column_type = 'sa.Text()'
return column_type
评论列表
文章目录