Skip to content

Commit

Permalink
base.py: comments for get_model()
Browse files Browse the repository at this point in the history
  • Loading branch information
astronomygupta committed Jul 27, 2024
1 parent 239b1e8 commit 5665cdc
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion python/target_selection/cartons/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,23 @@ def get_model(self):
"""Returns a Peewee model for the temporary table using reflection."""

# peewee has a Model class, BaseModel class, and ModelBase class.
# The below Model class is different from peewee Model class
# The below Model class is different from peewee Model class.
# The below BaseModel class is from sdssdb.peewee.
# It is different from peewee BaseModel class.
#
# The below line is from sdssdb/peewee/__init__.py
#
# class BaseModel(Model, metaclass=ReflectMeta):
#
# The above line, relates the below Model class to
# the ReflectMeta metaclass.
# Inside the ReflectMeta metaclass is the code in __new__()
# which generates the Model class.
#
# So defining the Model class here leads to creation of
# the Model class. Later below we have the statement
# "return Model" which is the last statement of get_model().
#
class Model(BaseModel):
catalogid = peewee.BigIntegerField(primary_key=True)
selected = peewee.BooleanField()
Expand Down

0 comments on commit 5665cdc

Please sign in to comment.