from odps import ODPS # 阿里云odps连接 access_id = 'LTAIWYUujJAm7CbH' access_key = 'RfSjdiWwED1sGFlsjXv0DlfTnZTG1P' endpoint = 'http://service.cn.maxcompute.aliyun.com/api' project_name = 'loghubods' odps = ODPS( access_id=access_id, secret_access_key=access_key, project=project_name, endpoint=endpoint ) def query_video_title_perfermance(start_idx, limit): # 查询视频标题的表现(从阿里云odps中查询) sql = f"SELECT * FROM video_allbusinesstype_data WHERE dt = '20231120' and view_times > 10 AND title is not NULL AND title != '' ORDER BY videoid LIMIT {start_idx}, {limit};" result = [] with odps.execute_sql(sql).open_reader() as reader: for record in reader: # 处理查询结果 result.append(record) return result