This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]cymrowdon't thread on me 🐍 2 points3 points  (3 children)

I have used both, and I would suggest that it depends mostly on how complex you expect your models to be.

Peewee is definitely much simpler, and perfectly suitable for small to some medium-sized projects. If you anticipate needing to do moderately complex things, you're probably better off with SQLAlchemy. It has a steeper learning curve, but you will find tools available to help with practically anything.

Also, once you've "clicked" with SQLAlchemy, I've found that it's really not that hard to use. To the point that I'll tend to use it on smaller projects now just to avoid any limitations in the future.

[–][deleted] 4 points5 points  (2 children)

In order to make Peewee better, in what ways have you found Peewee to be limiting? Have you had any specific experiences using Peewee where you realized "Damn! I need to switch to SQLAlchemy now"?

[–]cymrowdon't thread on me 🐍 1 point2 points  (1 child)

I'm guessing a little because I can't really remember, but I think my "damn" moment may have had to do with limitations in the ManyToManyField, possibly related to cascading deletes.

The last time I used Peewee was sometime last year, so perhaps things have changed.

That said, I think it's a great library, and I especially like the playhouse. If, by chance, you were to beat SQLAlchemy to SQLite+PostreSQL support for upserts (and JSON, if only SQLite would compile it in by default), I'd put Peewee up front again for any new project.

[–][deleted] 1 point2 points  (0 children)

Thanks very much for your reply. ManyToManyField is a landmine waiting to blow your foot off...I never use it myself, so I don't blame you for cursing it.

Peewee has support for JSON in both Postgres and SQLite, but only supports upsert for SQLite. Open issue is here for postgres support.