python中pd.read_sql()读取多个select后得到多个datafram

def ExceQuery(sql, database, chunksizes):
    engine = create_engine(database)
    if chunksizes == None:
        df_list = pd.read_sql(sql, engine)
    else:
        df_list = []
        for chunk in pd.read_sql(sql, engine, chunksize=chunksizes):
            df_list.append(chunk)
    print(sql[0:40])  # 在多线程运行后查看是哪个sql语句运行完成了,以便清楚是堵在哪个查询上了
    print(datetime.datetime.now().strftime(‘%Y-%m-%d %H:%M:%S’))

    return df_list


注意:chunksize 要比最多的那个select 选出的行数大

    原文作者:use_my_heart
    原文地址: https://blog.csdn.net/use_my_heart/article/details/52184897
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞