0
点赞
收藏
分享

微信扫一扫

OperationalError: (sqlite3.OperationalError) no such table


使用绝对路径,不要使用相对路径。使用相对路径的时候,系统回去找它自己建的库,而不是你的那个。 

# 获取当前文件的绝对路径
path = __file__.replace(fr"\{os.path.basename(__file__)}", "").replace("\\\\", "\\")
SQLITE_URI = fr'sqlite:///{path}\fastapi.db'

举报

相关推荐

0 条评论