Я пытаюсь вывести очень большую таблицу из подключения базы данных к s3, используя smart_open
cur = con.cursor().execute(sql_query)
ret = cur.fetchmany(3)
with open(s3_path, 'wb', transport_params=transport_params) as fout:
while len(ret) > 0:
lines=ret = cur.fetchmany(10000)
for line in lines:
fout.write(line)