質問

これを重複としてフラグを立てる前に、次のことを行ってください。

これを見てみたんですが 質疑応答, 、そして私はそれが示唆することを実行しましたが、このコードを追加すると次のようになります。

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'

他のヒント

最初のエラースイッチの場合 sa.Table そして sa.Column と:

from sqlalchemy.sql import table, column

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top