Connection Pooling _CursorFairy proxy is not fully transparent; iteration broken
Issue #1632
resolved
#!/usr/bin/python
import MySQLdb, MySQLdb.cursors
import sqlalchemy as sa
import sqlalchemy.pool
import sys
try:
if sys.argv[1](1) == '--pool':
MySQLdb = sa.pool.manage(MySQLdb, echo=True)
except IndexError: pass
db = MySQLdb.connect(host='localhost',user='...',passwd='...',db='...',cursorclass=MySQLdb.cursors.DictCursor)
c = db.cursor()
c.execute(**SELECT * FROM ...**)
for r in c:
print r['id']('id')
$ ./test.py
1
2
3
$ ./test.py --pool
2009-12-03 00:48:56,912 INFO sqlalchemy.pool.QueuePool.0x...6ccL Created new
connection <_mysql.connection open to 'localhost' at 9ac2e64>
2009-12-03 00:48:56,912 INFO sqlalchemy.pool.QueuePool.0x...6ccL Connection
<_mysql.connection open to 'localhost' at 9ac2e64> checked out from pool
Traceback (most recent call last):
File "./test.py", line 16, in <module>
for r in c:
TypeError: '_CursorFairy' object is not iterable
2009-12-03 00:48:56,924 INFO sqlalchemy.pool.QueuePool.0x...6ccL Connection
<_mysql.connection open to 'localhost' at 9ac2e64> being returned to pool
Comments (2)
-
repo owner -
repo owner - removed milestone
Removing milestone: 0.5.7 (automated comment)
- Log in to comment
648e0eb70c8f4e3db3b632409924a58d76d25008 4530dff59282e04c2aa891c420d89d49fff11ae3