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

Monde Ngalonkulu
Monde Ngalonkulu
8,021 Points

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.