小编Oma*_*ewa的帖子

表 X 没有名为 Y 的列 - SQLAlchemy

我正在 python 中使用 SQLAlchemy 库来映射我的数据库。我创建了一个包含我的数据库的文件,并且它运行没有问题。但是当我创建一个指定我的值的新行时,我收到一条错误消息

表menu_item没有名为description的列

 class MenuItem(Base):

        __tablename__ = 'menu_item'

        name = Column(String(80), nullable=False)
        id = Column(Integer, primary_key=True)
        course = Column(String(80))
        description = Column(String(250))
        price = Column(String(8))
        restaurant_id = Column(Integer, ForeignKey('restaurant.id'))
        restaurant = relationship(Restaurant)
Run Code Online (Sandbox Code Playgroud)

这是我的类 MenuItem 这是我的行值。

Cheesepizza = MenuItem(
    name="Chesse Pizza",
    description="Made with all natural ingredients and hot mozzarilla",
    course='Entree', price='$8.99', restaurant=myFirstRestaurant)
Run Code Online (Sandbox Code Playgroud)

我希望我应该为每一行分配 5 个值。我错过了什么吗?

python sql sqlalchemy

6
推荐指数
1
解决办法
4327
查看次数

Heroku登录-JSONError:在“”附近进行解析时,JSON输入意外结束

我正在尝试在终端上登录我的Heroku帐户。但是,当我键入时heroku login,会出现一条消息,提示按一个键打开我的浏览器,但浏览器无法打开,并且登录失败,然后出现此消息。

JSONError: Unexpected end of JSON input while parsing near ' '
at module.exports (/usr/lib/heroku/node_modules/parse-json/index.js:26:19)
at HTTP._parse (/usr/lib/heroku/node_modules/@heroku-cli/plugin-auth/node_modules/http-call/lib/http.js:343:25)
Run Code Online (Sandbox Code Playgroud)

请注意,如果重要,我正在使用虚拟机无所事事!另外,我正在使用Ubuntu OS。

在此处输入图片说明

更新:我不使用虚拟机就无法登录,并且我成功登录。所以,我怀疑Vagrant是问题所在!

terminal heroku vagrant

5
推荐指数
1
解决办法
2040
查看次数

标签 统计

heroku ×1

python ×1

sql ×1

sqlalchemy ×1

terminal ×1

vagrant ×1