我有以下功能可保持连接打开,但我不知道为什么。
connection=MySQLdb.connect("", "", "", "",
cursorclass = MySQLdb.cursors.SSCursor)
cursor=connection.cursor()
cursor.execute("select id, ...", (profile_id, ...))
try:
for row in cursor.fetchall():
yield row
except:
pass
finally:
connection.close()
我要去哪里错了?