解决:升级tortoise-orm到0.21.1以上版本,或使用github上的待发布版

poetry add 'tortoise-orm>=0.21.1' || poetry add 'git+https://github.com/tortoise/tortoise-orm.git'

或直接pip安装https://pip.pypa.io/en/stable/cli/pip_install/#examples

pip install --upgrade 'tortoise-orm>=0.21.1' || pip install --upgrade 'git+https://github.com/tortoise/tortoise-orm.git'

*注:pip安装时如果报443连接超时,可以用ssh的方式(本地公钥需配置到github里):

pip install --upgrade 'tortoise-orm>=0.21.1' || pip install --upgrade 'git+ssh://git@github.com/tortoise/tortoise-orm.git'

升级完成后,不再报错了

=====================================

如果还想消除warnning提示,可参照库文档的示例修改代码https://tortoise.github.io/examples/fastapi.html#main-py

Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐