Hello everyone,
Has anyone successfully run SQLAlchemy 0.7.8 or .9 with MySQL 5.5? How about in Ubuntu 12.04? ...with MySQL-python 1.2.3 or a 1.2.4beta?
I ask because Ubuntu 12.04 rescinds package manager support for MySQL 5.1, forcing us to upgrade to 5.5. Last week I experimentally upgraded a very stable server from {Ubuntu 11.10, MySQL 5.1, InnoDB, Python 2.7.2} to {Ubuntu 12.04, MySQL 5.5, InnoDB, Python 2.7.3}. Unfortunately, ever since the upgrade I have seen sporadic errors like this one:
Module sqlalchemy.engine.default:606 in create_cursor view
Module MySQLdb.connections:243 in cursor view
StatementError: 'Connection' object has no attribute 'cursorclass'
(original cause: AttributeError: 'Connection' object has no attribute
'cursorclass') 'SELECT DATABASE()' []
(Python 2.7.3, SQLAlchemy 0.7.8, MySQL-python 1.2.3, MySQL 5.5, Pylons 1.0, mod-wsgi, apache2)
The server will run normally for an hour or two before this error arises. Each time I hit this error, SHOW FULL PROCESSLIST shows a leaked connection. Subsequent attempts to use SQLAlchemy within the same process die with the same error, leaking one additional connection per error until the server's max connections limit is exceeded, resulting in this error:
Module sqlalchemy.engine.default:281 in connect view
Module MySQLdb:81 in Connect view
Module MySQLdb.connections:187 in __init__ view
OperationalError: (OperationalError) (1040, 'Too many connections') None None
At that point I am forced to restart mysql and apache2, and normal service resumes for a random interval, perhaps an hour or two. Then the SELECT DATABASE error returns, and I restart again.
The SQLAlchemy 0.7.9 docs state that "SQLAlchemy supports 6 major MySQL versions: 3.23, 4.0, 4.1, 5.0, 5.1 and 6.0,
with capabilities increasing with more modern servers." The docs do not explicitly state that 5.5 is no good, and I haven't read any horror stories on the list. This leads me to hope that the docs are out of date, and 5.5 might now be supported.
Before I rip out my MySQL 5.5 installation by the roots and built 5.1 from source, could somebody please confirm that 5.5 is positively unsupported by SQLAlchemy? If 5.5 is unsupported, are there plans to support it in the near future? Can anybody describe the failures I should expect with SQLAlchemy? Should I attribute my error to SQLAlchemy, or is it more likely to be MySQL-python's fault?
I appreciate any advice you all might offer.
MB
P.S. Here is the full stacktrace:
Module foo.controllers:176 in __before__ view
>> c.sauser = User.find_first(domain_id=unicode(remote_user))
Module bar.model:120 in find_first view
>> return cls.filter(*args, **kw).first()
Module sqlalchemy.orm.query:2156 in first view
Module sqlalchemy.orm.query:2023 in __getitem__ view
Module sqlalchemy.orm.query:2227 in __iter__ view
Module sqlalchemy.orm.query:2240 in _execute_and_instances view
Module sqlalchemy.orm.query:2231 in _connection_from_session view
Module sqlalchemy.orm.session:730 in connection view
Module sqlalchemy.orm.session:736 in _connection_for_bind view
Module sqlalchemy.engine.base:2490 in contextual_connect view
Module sqlalchemy.pool:224 in connect view
Module sqlalchemy.pool:387 in __init__ view
Module sqlalchemy.pool:741 in _do_get view
Module sqlalchemy.pool:188 in _create_connection view
Module sqlalchemy.pool:273 in __init__ view
Module sqlalchemy.event:282 in exec_once view
Module sqlalchemy.event:291 in __call__ view
Module sqlalchemy.engine.strategies:167 in first_connect view
Module sqlalchemy.dialects.mysql.base:1999 in initialize view
Module sqlalchemy.engine.default:176 in initialize view
Module sqlalchemy.dialects.mysql.base:1964 in _get_default_schema_name view
Module sqlalchemy.engine.base:1449 in execute view
Module sqlalchemy.engine.base:1628 in _execute_text view
Module sqlalchemy.engine.base:1651 in _execute_context view
Module sqlalchemy.engine.base:1647 in _execute_context view
Module sqlalchemy.engine.default:529 in _init_statement view
Module sqlalchemy.engine.default:606 in create_cursor view
Module MySQLdb.connections:243 in cursor view
StatementError: 'Connection' object has no attribute 'cursorclass'
(original cause: AttributeError: 'Connection' object has no attribute
'cursorclass') 'SELECT DATABASE()' []
References:
http://docs.sqlalchemy.org/en/rel_0_7/dialects/mysql.html
http://docs.sqlalchemy.org/en/latest/dialects/mysql.html