I'm trying to transfer a large data (15 B) from one database (postgresql) to other with python/psycopg2 on docker. My docker has 4 GB of memory and is getting out of memory.
What I am doing wrong?
cursor = conn.cursor()
cursor.execute('select * from schema.table')
for row in cursor:
tp = tuple(map(lambda x: x.encode('utf-8'), row)
cursor.execute('Insert into table2 values {}'.format(tp))
conn.commit()