Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialHara Gopal K
Courses Plus Student 10,027 PointsDatabases in Python: Generic Question on ORM
I guess the ORM that's being referred here is same as the one used in Django. whats the difference between the ORM in django and peewee. Is django ORM different from peewee in terms of the syntax or otherwise ?
Hara Gopal K
Courses Plus Student 10,027 PointsThank you Sabine, that definitely helped :)
Sabine Maennel
Treehouse Project ReviewerSabine Maennel
Treehouse Project ReviewerHello Hara, peewee is a very lightweigth ORM. For example it does not offer any validation for fields on purpose. You can specify a model, say:
from peewee import *
class Employee(Model): first_name = CharField(max_length=100) last_name = CharField(max_length=100)
And still you are able to enter any nonesense into the database with peewees database operations, since they do not check the field values and wether the fields are entered as specified.
Django on the otherhand is a heavyweigth. It offers a lot of internal checking. When you use ModelForms, they just know what fields should look like, not chance to get bad values into the database via the Django orm. That is one reason why you could not go with an 'import *' statement, like the one that is in use for peewee.
So the orm is a tool: you choose the one that fits your application. If you do not need complicated queries and if you do not need and orm that helps you with data integrity, that peewee is a good tool, but if data integrity is an issue, that django orm might be the better choice.
Does that answer your question?