Guest User

Untitled

a guest
Apr 23rd, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. conn=pg.connect(host="XXX",database="XXX", user="XXX", password="XXX")
  2. cur = conn.cursor('my_cursor')
  3.  
  4. cur.execute("select XX,XXX from XXXX")
  5. count = 0
  6. data = []
  7.  
  8. while True:
  9. rows = cur.fetchmany(100)
  10. if not rows:
  11. break
  12.  
  13. for id, xml in rows:
  14.  
  15. count += 1
  16. if count % 5000 == 0:
  17. print('processing The %d record' % count)
  18. data.append(Extract_info(id, xml, 'progressive', Dict_info))
  19. pass
  20.  
  21. cur.close()
Add Comment
Please, Sign In to add comment