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 选出的行数大