def select_url(self): try: connect = get_connect() cursor = connect.cursor() print("connection") sql = "SELECT id,source_url FROM toutiao_news where id >(select min(t.id) from (select id from toutiao_news where content is null order by id) t) order by id desc " cursor.execute(sql) result = cursor.fetchall() for row in result: # print(row[0]) news = News() news.id = row[0] news.source_url = row[1] self.news_list.append(news) except Exception as e: print(e)
def select_url(): arrList = [] try: connect = get_connect() cursor = connect.cursor() print("connection") sql = "SELECT id,source_url FROM toutiao_news WHERE id > 15855" cursor.execute(sql) result = cursor.fetchall() for row in result: # print(row[0]) news = News() news.id = row[0] news.source_url = row[1] arrList.append(news) except Exception as e: print(e) finally: return arrList