sqlalchemy.exc.ArgumentError: 'SchemaItem' object, such as a 'Column' or a 'Constraint' expected

解決方案:

friendships = Table('friendships',
                    Base.metadata,
                    Column('follower_id', Integer(), ForeignKey('user.id')),
                    Column('followed_id', Integer(), ForeignKey('user.id'))

  

  1. Table(...)必須有一個MetaData實例作爲第二個參數,而您缺少該參數。
  2. Column用大寫拼寫c。它應該是Column
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章