Next / Previous / Contents / NM Tech homepage

6.10. The cir_physio table

This table is the intermediate table in the many-to-many relation between circles and physios.

pycbc.py
    cir_physio_table = schema.Table('cir_physio', meta,
        schema.Column('lat',         types.CHAR(4)),
        schema.Column('lon',         types.CHAR(5)),
        schema.Column('physio_pos',  types.SMALLINT, nullable=False),
        schema.Column('physio_code', types.CHAR(2),
            schema.ForeignKey('physios.physio_code')),
        schema.PrimaryKeyConstraint('lat', 'lon', 'physio_code'),
        schema.ForeignKeyConstraint(('lat', 'lon'),
            ('circles.lat', 'circles.lon')))

    class CirPhysio(object):
        def __init__(self, lat, lon, physio_pos, physio_code):
            self.lat = lat
            self.lon = lon
            self.physio_pos = physio_pos
            self.physio_code = physio_code
        def __repr__(self):
            return ( "<CirPhysio(%sn %sw[%d]%s)>" %
                     (self.lat, self.lon, self.physio_pos,
                      self.physio_code) )