':returns: 0 on success, 1 if no uuid column, 2 if insert failed.'

def _test_archive_deleted_rows_for_one_uuid_table(self, tablename):

    skip_tables = ['resource_providers']
    if (tablename in skip_tables):
        return 1
    main_table = sqlalchemyutils.get_table(self.engine, tablename)
    if (not hasattr(main_table.c, 'uuid')):
        return 1
    shadow_table = sqlalchemyutils.get_table(self.engine, ('shadow_' + tablename))
    for uuidstr in self.uuidstrs:
        ins_stmt = main_table.insert().values(uuid=uuidstr)
        try:
            self.conn.execute(ins_stmt)
        except (db_exc.DBError, OperationalError):
            return 2
    update_statement = main_table.update().where(main_table.c.uuid.in_(self.uuidstrs[:4])).values(deleted=1)
    self.conn.execute(update_statement)
    qmt = sql.select([main_table]).where(main_table.c.uuid.in_(self.uuidstrs))
    rows = self.conn.execute(qmt).fetchall()
    self.assertEqual(len(rows), 6)
    qst = sql.select([shadow_table]).where(shadow_table.c.uuid.in_(self.uuidstrs))
    rows = self.conn.execute(qst).fetchall()
    self.assertEqual(len(rows), 0)
    sqlalchemy_api._archive_deleted_rows_for_table(tablename, max_rows=2)
    rows = self.conn.execute(qmt).fetchall()
    self.assertEqual(len(rows), 4)
    rows = self.conn.execute(qst).fetchall()
    self.assertEqual(len(rows), 2)
    sqlalchemy_api._archive_deleted_rows_for_table(tablename, max_rows=2)
    rows = self.conn.execute(qmt).fetchall()
    self.assertEqual(len(rows), 2)
    rows = self.conn.execute(qst).fetchall()
    self.assertEqual(len(rows), 4)
    sqlalchemy_api._archive_deleted_rows_for_table(tablename, max_rows=2)
    rows = self.conn.execute(qmt).fetchall()
    self.assertEqual(len(rows), 2)
    rows = self.conn.execute(qst).fetchall()
    self.assertEqual(len(rows), 4)
    return 0
