程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了我得到 sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) table song has no column named name大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决我得到 sqlalchemy.exc.operationalError: (sqlite3.operationalError) table song has no column named name?

开发过程中遇到我得到 sqlalchemy.exc.operationalError: (sqlite3.operationalError) table song has no column named name的问题如何解决?下面主要结合日常开发的经验,给出你关于我得到 sqlalchemy.exc.operationalError: (sqlite3.operationalError) table song has no column named name的解决方法建议,希望对你解决我得到 sqlalchemy.exc.operationalError: (sqlite3.operationalError) table song has no column named name有所启发或帮助;

我有如下模型@H_801_3@


class Song(BasE):
    __tablename__ = 'song'
    ID = column(Integer,priMary_key=True,index=TruE)
    name = column(String,index=TruE)
    duration = column(Integer,index=TruE)
    uploaded_time = column(datetiR_106_11845@e,index=TruE)

架构如下。@H_801_3@


class SongBase(BaseModel):
    name: str
    duration: int
    uploaded_time: datetiR_106_11845@e

class Song(SongBasE):
    class Config():
        orm_mode = True

class ShowSong(BaseModel):
    name: str
    duration: int
    uploaded_time: datetiR_106_11845@e
    class Config():
        orm_mode = True

我正在使用它来创建如下请求:@H_801_3@

def create(request: scheR_106_11845@as.song,db: session):
    new_song = models.song(name=request.name,duration=request.duration,uploaded_time=request.uploaded_timE)
    db.add(new_song)
    db.commit()
    db.refresh(new_song)
    return new_song

我的帖子请求如下:@H_801_3@

# post for audio
@router.post('/',status_code=status.http_201_CREATED)
def create(request: scheR_106_11845@as.song,db: session = Depends(get_db)):
    return audio.create(request,db)

我收到如下错误:@H_801_3@

sqlalchemy.exc.operationalError: (sqlite3.operationalError) table song has no column named name
[sql: INSERT INTO song (name,duration,uploaded_timE) VALUES (?,?,?)]
[parameters: ('bcygchgb',1,'2021-04-13 11:47:29.412000')]
(BACkground on this error at: http://sqlalche.me/e/e3q8)

对此有何想法@H_801_3@

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!@H_801_3@

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。@H_801_3@

小编邮箱:dio#foxmail.com (将#修改为@)@H_801_3@

大佬总结

以上是大佬教程为你收集整理的我得到 sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) table song has no column named name全部内容,希望文章能够帮你解决我得到 sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) table song has no column named name所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。