V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
jenlors
V2EX  ›  Python

各位,有用 tortoise-orm 的吗?

  •  
  •   jenlors · 2020-05-16 08:19:47 +08:00 · 4169 次点击
    这是一个创建于 1441 天前的主题,其中的信息可能已经有所发展或是发生改变。

    如果你的项目基于 fastapi 或者 starletted 等异步框架,并且需要一个 ORM 框架的话,那么 tortoise-orm 一定是你当前最佳选择了。

    好吧,其实我不是来推荐 tortoise-orm 的,而是她:aerich,一个为 tortoise-orm 而生的数据库迁移工具。

    类似于 alembic for SQLAlchemy,或者 Django ORM 自带的工具。

    当前支持基于 tortoise-orm 的数据库 DDL 更改,目前只支持 MySQL,但是扩展到 postgres 和 sqlite 也是非常容易的。

    如果这个项目对你有所帮助,请不吝 star 。

    项目地址:https://github.com/long2ice/aerich

    3 条回复    2020-08-06 12:15:03 +08:00
    watsy0007
        1
    watsy0007  
       2020-05-16 11:05:26 +08:00
    正在用 tortoise-orm, 迁移工具还是 alembic.
    tortoise-orm 官方后面排期会加入 migration.
    楼主可以提 pr
    jenlors
        2
    jenlors  
    OP
       2020-05-16 13:36:52 +08:00
    alembic 只支持 SQLAlchemy 吧?
    johnsona
        3
    johnsona  
       2020-08-06 12:15:03 +08:00
    alembic 问题一大堆,改个字段名直接删了重新建,改字段类型迁移不生效,伤透了心,手动 ddl 了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2834 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 14:52 · PVG 22:52 · LAX 07:52 · JFK 10:52
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.