testCases.py 1.16 KB

import pymysql
import pandas as pd
DIRECTORY_PATH = '/data2/models/'

def get_video_id():
    db = pymysql.connect(host='10.66.157.22', port=4000, user='root', passwd='3SYz54LS9#^9sBvC', db='eagle')
    cursor = db.cursor()
    sql = "select diary_id from feed_diary_boost;"
    cursor.execute(sql)
    result = cursor.fetchall()
    df = pd.DataFrame(list(result))
    video_id = df[0].values.tolist()
    print(video_id[:10])
    db.close()
    return video_id

def queue():
    db = pymysql.connect(host='rm-m5e842126ng59jrv6.mysql.rds.aliyuncs.com', port=3306, user='doris',
                         passwd='o5gbA27hXHHm', db='doris_prod')
    cursor = db.cursor()
    sql = "select native_queue from device_diary_queue where device_id = 'AB20292B-5D15-4C44-9429-1C2FF5ED26F6';"
    cursor.execute(sql)
    result = cursor.fetchall()
    df = pd.DataFrame(list(result))
    all = df.loc[0,0].split(",")
    print(all[:10])
    db.close()
    return all

if __name__=="__main__":
    all = queue()
    video = get_video_id()
    video_id = []
    x = 1
    while x < len(all):
        video_id.append(all[x])
        x += 3
    a = list(set(video)&set(video_id))
    print(a == video_id)