'Examines the project_id, user_id of the object along with the
supplied consumer_id and ensures that there are records in the
consumers, projects, and users table for these entities.
:param consumer_id: Comes from the Allocation object being processed'

def _ensure_consumer_project_user(self, conn, consumer_id):

    if (self.obj_attr_is_set('project_id') and (self.project_id is not None) and self.obj_attr_is_set('user_id') and (self.user_id is not None)):
        pid = _ensure_project(conn, self.project_id)
        uid = _ensure_user(conn, self.user_id)
        sel_stmt = sa.select([_CONSUMER_TBL.c.uuid]).where((_CONSUMER_TBL.c.uuid == consumer_id))
        result = conn.execute(sel_stmt).fetchall()
        if (not result):
            try:
                conn.execute(_CONSUMER_TBL.insert().values(uuid=consumer_id, project_id=pid, user_id=uid))
            except db_exc.DBDuplicateEntry:
                pass
