Re: [sqlalchemy] Re: order_by with explicit column name messes up subqueryload

2012-01-08 Thread Michael Bayer
On Jan 8, 2012, at 3:16 PM, Yuen Ho Wong wrote: > Except that LIMIT and OFFSET are present in my query, gnarly isn't > it ? :P > >d = label("distance", > some_complicated_geoalchemy_function_call(columns...)) > >q = session.query(Product, Merchant.location, d)\ >.join(Mercha

[sqlalchemy] Re: order_by with explicit column name messes up subqueryload

2012-01-08 Thread Yuen Ho Wong
Here are the models: class Merchant(Base): __tablename__ = "merchant" id = Column(Integer, autoincrement=True, primary_key=True) location = GeometryColumn(Point, nullable=False) class SearchOption(Base): __tablename__ = "searchoption" id = Column(Integer, autoincrement=True, p

[sqlalchemy] Re: order_by with explicit column name messes up subqueryload

2012-01-08 Thread Yuen Ho Wong
Except that LIMIT and OFFSET are present in my query, gnarly isn't it ? :P d = label("distance", some_complicated_geoalchemy_function_call(columns...)) q = session.query(Product, Merchant.location, d)\ .join(Merchant, Product.merchant_id == Merchant.id)\ .filter(Pr

Re: [sqlalchemy] order_by with explicit column name messes up subqueryload

2012-01-08 Thread Michael Bayer
On Jan 8, 2012, at 2:47 PM, Yuen Ho Wong wrote: > Hi, > > I have a rather complicated problem and I was wondering if you guys > could help. > > So I have a query, session.query(Product, Merchant, d), where Product > is 1-to-many with Merchant, and d is the distance from some lat long. > d is ac

[sqlalchemy] Re: order_by with explicit column name messes up subqueryload

2012-01-08 Thread Yuen Ho Wong
BTW, aliased() and alias() don't work on a label() either. I tried passing the label object straight into the order_by() as well to no avail. I'm all out of ideas. On Jan 9, 3:47 am, Yuen Ho Wong wrote: > Hi, > > I have a rather complicated problem and I was wondering if you guys > could help. >

[sqlalchemy] order_by with explicit column name messes up subqueryload

2012-01-08 Thread Yuen Ho Wong
Hi, I have a rather complicated problem and I was wondering if you guys could help. So I have a query, session.query(Product, Merchant, d), where Product is 1-to-many with Merchant, and d is the distance from some lat long. d is actually a sqlalchemy.sql.label() of some complicated GeoAlchemy fun