在你标记这个问题为重复之前:
我确实看过这个问题/答案,并且按照它的建议去做了,但是当我添加这段代码时:
permslookup = sa.Table('permslookup',
sa.Column('perms_lookup_id', primary_key=True),
sa.Column('name', sa.Unicode(40), index=True),
sa.Column('description', sa.Text),
sa.Column('value', sa.Numeric(10, 2)),
sa.Column('ttype', sa.PickleType(), index=True),
sa.Column('permission', sa.Unicode(40), index=True),
sa.Column('options', sa.PickleType())
)
当我运行
alembic upgrade head
时,出现以下错误:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema'
当我检查完整的堆栈跟踪时,我注意到这是导致错误的原因:
sa.Column('options', sa.PickleType())
这是以上代码的最后一行...我该怎么解决?我不知道如何解决它...非常感谢任何帮助。
这是我想要插入的数据:
op.bulk_insert('permslookup',
[
{
'id': 1,
'name': 'accounts',
'description': """ Have permission to do all transactions """,
'value': 1,
'ttype': ['cash', 'loan', 'mgmt', 'deposit', 'adjustments'],
'permission': 'accounts',
'options': None
},
{
'id': 2,
'name': 'agent_manage',
'description': """ Have permission to do cash, cash, loan and Management Discretion transactions """,
'value': 2,
'ttype': ['cash', 'loan', 'mgmt'],
'permission': 'agent_manage',
'options': None
},
{
'id': 3,
'name': 'corrections',
'description': """ Have permission to do cash, loan and adjustments transactions """,
'value': 3,
'ttype': ['cash', 'loan', 'adjustments'],
'permission': 'corrections',
'options': None
},
{
'id': 4,
'name': 'cashup',
'description': """ Have permission to do cash and loan transactions """,
'value': 4,
'ttype': ['cash', 'loan'],
'permission': 'cashup',
'options': None
},
]
)
当我尝试运行
bulk_insert
时,我遇到的原始错误是:AttributeError: 'str' object has no attribute '_autoincrement_column'
:)
- Renier