Created
March 11, 2014 14:22
-
-
Save openinx/9486743 to your computer and use it in GitHub Desktop.
PyMySQL如何一般执行SELECT * FROM BIG_TABLE语句一边fetch数据呢?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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