Next / Previous / Contents / NM Tech homepage

6.4. class CBCData: The database interface

The actual class declaration begins here. All the metadata—schema, tables, and object-relational mappings—are declared inside this class. The mapped classes are also inside this class; the author found this somewhat disturbing at first, but it makes perfect sense. For example, if a user has an instance db of class CBCData, they can refer to the circles table as db.circles_table or as CBCData.circles_table. Similarly, they can refer to the constructor the class mapped to that table either as db.Circle or CBCData.circle.

pycbc.py
# - - - - -   c l a s s   C B C D a t a

class CBCData(object):
    '''Represents the entire Christmas Bird Count database.
    '''