def store(self):

        db = current.db

        _debug("Storing Job ID=%s", self.job_id)

        self.__define_tables()
        jobtable = self.job_table
        query = jobtable.job_id == self.job_id
        row = db(query).select(jobtable.id, limitby=(0, 1)).first()
        if row:
            record_id = row.id
        else:
            record_id = None
        record = Storage(job_id=self.job_id)
        try:
            tablename = self.table._tablename
        except:
            pass
        else:
            record.update(tablename=tablename)
        for item in self.items.values():
            item.store(item_table=self.item_table)
        if record_id:
            db(jobtable.id == record_id).update(**record)
        else:
            record_id = jobtable.insert(**record)

        _debug("Job record ID=%s", record_id)

        return record_id

    # -------------------------------------------------------------------------
Store this job and all its items in the job table
dataset/ETHPy150Open sahana/eden/modules/s3/s3import.py/S3ImportJob.store