问答详情
源自:3-1 根据项目需求设计mysql数据库结构

数据库连接

创建数据库这一块一直出现这个问题,一直不知道要怎么解决?有会的大神可以帮忙以下吗

D:\python\imooc_lagou\venv\Scripts\python.exe D:/python/imooc_lagou/create_lagou_tables.py

Traceback (most recent call last):

  File "D:/python/imooc_lagou/create_lagou_tables.py", line 17, in <module>

    class Lagoutables(Base):

  File "D:\python\imooc_lagou\venv\lib\site-packages\sqlalchemy\ext\declarative\api.py", line 75, in __init__

    _as_declarative(cls, classname, cls.__dict__)

  File "D:\python\imooc_lagou\venv\lib\site-packages\sqlalchemy\ext\declarative\base.py", line 131, in _as_declarative

    _MapperConfig.setup_mapping(cls, classname, dict_)

  File "D:\python\imooc_lagou\venv\lib\site-packages\sqlalchemy\ext\declarative\base.py", line 160, in setup_mapping

    cfg_cls(cls_, classname, dict_)

  File "D:\python\imooc_lagou\venv\lib\site-packages\sqlalchemy\ext\declarative\base.py", line 192, in __init__

    self._setup_inheritance()

  File "D:\python\imooc_lagou\venv\lib\site-packages\sqlalchemy\ext\declarative\base.py", line 589, in _setup_inheritance

    "table-mapped class." % cls

sqlalchemy.exc.InvalidRequestError: Class <class '__main__.Lagoutables'> does not have a __table__ or __tablename__ specified and does not inherit from an existing table-mapped class.


提问者:慕无忌3475426 2020-01-05 12:27

个回答

  • weixin_慕九州520781
    2020-03-05 19:15:46

    应该是没有创建数据表