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 trial

Python Using Databases in Python Meet Peewee Modeling

I need help understanding the definition of model

model - A code object that represents a database table What does it mean "code object"? I know what an object is but everytime Kenneth used the word he was talking about the class.

1 Answer

First of all, I think you should check out the official docs from Peewee that shows how the Model corresponds to the database "things": http://docs.peewee-orm.com/en/latest/peewee/models.html

The docs should hold more authority in terms of what a Model is. There they have something like this:

[Thing | Corresponds to…] Model class | Database table Field instance | Column on a table Model instance | Row in a database table

Now, bearing in mind that an object is an instance of a class, I think we can safely assume that Kenneth probably meant that a model is a class that represents a database table.

If you talk about objects and classes a lot, you're bound to say one in place of the other. Like, I meant to say "classes and objects" just now (instead of "objects and classes" ) 🀦 - a joke btw

Thanks a lot! This really helped.