请问一下,为什么我数据库中少生成一张book表?其他那三张表(user、gift、wish)都生成了
来源:10-7 类变量的陷阱
逆时针丿
2018-05-29
base.py from contextlib import contextmanager from flask_sqlalchemy import SQLAlchemy as _SQLAlchemy from sqlalchemy import Column, Integer, SmallInteger class SQLAlchemy(_SQLAlchemy): @contextmanager def auto_commit(self): try: yield self.session.commit() except Exception as e: # rollback(回滚) db.session.rollback() raise e db = SQLAlchemy() class Base(db.Model): __abstract__ = True create_time = Column('create_time', Integer) status = Column(SmallInteger, default=1) def set_attrs(self, attrs): for key, value in attrs.items(): if hasattr(self, key) and key != 'id': setattr(self, key, value)
写回答
1回答
-
7七月
2018-05-30
你没有引用某个模型,这个模型所对应的表就不会生成。
012018-05-30
相似问题