1
工作我试图从一个数据库(PostgreSQL系统)传输大量数据(15二)其他与Python/psycopg2的码头工人。我的码头有4 GB的内存,并且内存不足。Python的psycopg2 - 大数据
我做错了什么?
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()
到这里看看:http://stackoverflow.com/a/10147451/771848。希望有所帮助。 – alecxe
谢谢。但是我的问题是使用光标,即将所有数据存入内存。 –