class Foo(Base):
    __table__ = Table('foo', Base.metadata, Column('id', Integer,
        primary_key=True), Column('a', Integer(), nullable=False), Column(
        'b', Integer(), nullable=False), Column('c', Integer(), nullable=False)
        )
engine = create_engine('mysql+mysqldb://scott:tiger@localhost/test', echo=True)
sess = Session(engine)
now = time.time()
for obj in sess.query(Foo).yield_per(100).limit(1000000):
    pass
print('Total time: %d' % (time.time() - now))
Why is loading SQLAlchemy objects via the ORM 5-8x slower than rows via a raw MySQLdb cursor?