the order_by set on the mapper() is stripped out when using get() with
0.5:
import sqlalchemy as sa
import sqlalchemy.orm as orm
from sqlalchemy.ext.declarative import declarative_base
import StringIO
import logging
buf = StringIO.StringIO()
logging.basicConfig(stream=buf, format = '%(message)s')
logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO)
Base = declarative_base(engine=sa.create_engine('sqlite://'))
class Foo(Base):
__tablename__ = 'foo'
id = sa.Column(sa.Integer, primary_key=True)
data = sa.Column(sa.String)
__mapper_args__ = {'order_by':data}
Base.metadata.create_all()
sess = orm.create_session()
buf.truncate(0)
sess.query(Foo).filter(Foo.id==5).all()
assert "ORDER BY foo.data" in buf.getvalue()
buf.truncate(0)
sess.query(Foo).get(5)
assert "ORDER BY" not in buf.getvalue()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---