def makeRecordClass(db,record_class,field_names):
    """Generate a subclass of record_class, specifying a Base instance 
    and a list of field names and types"""

    class _Record(record_class):
        pass

    setattr(_Record,'db',db)
    setattr(_Record,'fields',list(field_names))
    setattr(_Record,'types',[ db.fields[f] for f in field_names ])
    return _Record