for item in items["messages"]:
values += item["message"] + "\n"
you first iterate over all the element a first time , and the your stringio need to go once again over all the bytes when you do the insert
by using this https://stackoverflow.com/a/32020108/1185460
you could directly feed you copy_from with an file-like iterator :)
for item in items["messages"]:
values += item["message"] + "\n"
you first iterate over all the element a first time , and the your stringio need to go once again over all the bytes when you do the insert
by using this https://stackoverflow.com/a/32020108/1185460
you could directly feed you copy_from with an file-like iterator :)