def validate(self):
        columns = self.__mapper__.columns
        for key, column in columns.items():
            value = getattr(self, key)
            if not self.type_compatible(value, column.type):
                raise exception.InvalidParameter(
                    'column %s value %r type is unexpected: %s' % (
                        key, value, column.type
                    )
                )
Generate validate function to make sure the record is legal.
dataset/ETHPy150Open openstack/compass-core/compass/db/models.py/HelperMixin.validate