我有兩個班,但他們似乎無法相互連接。我得到的錯誤是:似乎無法有從另一個表變量 - SQLAlchemy的
OperationalError: (OperationalError) no such column: user_points.user_id
任何想法爲什麼這樣?
class User(db.Model):
__tablename__ = "user"
id = db.Column('user_id',db.Integer , primary_key=True)
username = db.Column(db.String(20), unique=True , index=True)
password = db.Column(db.String(20))
firstname = db.Column(db.String(20))
surname = db.Column(db.String(20))
email = db.Column(db.String(100))
dt_joined = db.Column(db.DateTime, default=db.func.now())
points_rel = db.relationship('User_points',backref='pointers',lazy='dynamic')
# User Points table
class User_points(db.Model):
__tablename__ = "user_points"
id = db.Column('user_points_id',db.Integer, primary_key = True)
user_id = db.Column('user_id',db.Integer, db.ForeignKey('user.user_id'))
fixture_id = db.Column('fixture_id',db.Integer, db.ForeignKey('fixture.fixture_id'))
fixture_prediction_id = db.Column('fixture_prediction_id',db.Integer, \
db.ForeignKey('fixture_prediction.fixture_id'))
points = db.Column('points',db.Integer)
任何想法的人?這是做我的頭:(
人有什麼想法? :( – Lorbat