Next / Previous / Contents / NM Tech homepage

9.8. transloader: addCensus()

transloader
# - - -   a d d C e n s u s

def addCensus(db, lat, lon, year_no, year_key, cen):
    '''Add one row to the censuses table.

      [ (db is a CBCData instance) and
        (lat is a latitude as 'ddmm') and
        (lon is a longitude as 'dddmm') and
        (year_no is a year number as 'nnn') and
        (year_key is a year key) and
        (cen is a MyCBC.Cen instance) ->
            db.s  +:=  a new db.Census instance representing cen ]
    '''

For the Census constructor, see Section 6.12, “The censuses table”.

transloader
    census = db.Census(lat, lon, year_no, year_key, cen.seq_no,
        cen.form, cen.rel, cen.alt_form, cen.age, cen.sex,
        cen.plus, cen.q, cen.census)
    db.s.add ( census )