Skip to content

Instantly share code, notes, and snippets.

@openinx
Created March 11, 2014 14:22
Show Gist options
  • Save openinx/9486743 to your computer and use it in GitHub Desktop.
Save openinx/9486743 to your computer and use it in GitHub Desktop.
PyMySQL如何一般执行SELECT * FROM BIG_TABLE语句一边fetch数据呢?
conn = pymysql.connect(user='root',host='127.0.0.1', port=3306, db='test')
try:
cursor = conn.cursor(pymysql.cursors.SSCursor)
cursor.execute('select * from sbtest')
while True:
row = cursor.fetchone()
if not row:
break
print row
finally:
cursor.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment