0
我有我想要建模的現有數據。它的本質:在SQLAlchemy中定義許多沒有外鍵的對象
class Investor(db.Model):
id = db.Column(id, primary_key=True)
investments = db.relationship('Investments', backref='investor')
class Round(db.Model):
id = db.Column('id', primary_key=True)
investments = db.Table(
'investments',
db.Column('investor_id', db.ForeignKey('investor.id')),
db.Column('round_id', db.ForeignKey('round.id')),
)
現在,每次我試圖執行這個小模型,我收到以下錯誤時間: 表達「投資」未能找到一個名字
我明白,投資,需要有一個類,但我已經嘗試使用db.model創建一個虛擬類,但它並沒有真正起作用。在那個版本中,我遇到了詢問主要連接或映射器的問題。我很困惑,一點指導會大大幫助。