外键报错
来源:9-6 用户注册
雨木送清风
2019-09-25
from app.models.base import db, Base
from sqlalchemy import Column, Integer, String, Boolean, ForeignKey, desc, func
from sqlalchemy.orm import relationship
__author__ = 'SimonChan'
class Gift(Base):
id = Column(Integer, primary_key=True)
user = relationship('User')
uid = Column(Integer, ForeignKey('user.id'))
isbn = Column(String(15), nullable=False)
# book = relationship('Book')
# bid = Column(Integer, ForeignKey('user.id'))
launched = Column(Boolean, default=False)
from app.models.base import db, Base
from sqlalchemy import Column, Integer, String, Boolean, Float
__author__ = 'SimonChan'
class User(Base):
# __tablename__ = 'user'
id = Column(Integer, primary_key=True)
nickname = Column(String(24), nullable=False)
phone_number = Column(String(18), unique=True)
# _password = Column('password', String(128), nullable=False)
email = Column(String(50), unique=True, nullable=False)
confirmed = Column(Boolean, default=False)
beans = Column(Float, default=0)
send_counter = Column(Integer, default=0)
receive_counter = Column(Integer, default=0)
wx_open_id = Column(String(50))
wx_name = Column(String(32))
写回答
1回答
-
7七月
2019-09-25
提示是没有找到user 这张表。我觉得核对下源代码看看吧。
052019-09-25
相似问题