Fixed up the SQLAlchemy extension and its tests.