Python lightweight database wrapper for SQLite

前端 未结 7 501
离开以前
离开以前 2021-02-01 15:01

Is there a lightweight database wrapper in Python that I can use for SQLite. I would like something like Django\'s ORM, but that I can just point to a database file and it\'ll m

7条回答
  •  执笔经年
    2021-02-01 15:36

    Definitely peewee. I've tried sqlalchemy but it's a mess and there is no magic.

    Other ORMs are no more developed or not so good, like SQLobject, Elixir (layer on top of sqlalchemy), PonyORM. Peewee is the best I've seen so far in the python community, and it's the closer to the main ORMs for ruby or for php.

    Peewee also have many gems, like this handful shortcut

    Person.get_or_create(name='Foo', surname='Bar')
    

    that automagically take the person named 'Foo Bar' from the DB if it exists, otherwise it creates it .

提交回复
热议问题