[sqlalchemy] Limiting query with custom order_by and eagerload

2011-06-07 Thread Yoann Roman
I ran into a problem with a rather unique query on SA 0.6.5 (reproducible on 0.7.1). The query eagerloads a collection, undefers a scalar-select column, orders on the latter, and applies a limit/ offset. To order by a scalar-select column without executing the subquery again, I have to apply a

[sqlalchemy] Querying with polymorphism

2010-01-29 Thread Yoann Roman
Given the following relationships: employees_table = Table('employees', metadata, Column('id', Integer, primary_key=True), Column('row_type', Integer, nullable=False) Column('name', String(50)), Column('is_certified', Boolean) ) employee_mapper = mapper(Employee, employees_table,

[sqlalchemy] Re: Invalid SQL for not None on relation attributes

2008-11-24 Thread Yoann Roman
Not yet, I'm still recovering from the first one :-). On Nov 20, 10:50 pm, Michael Bayer [EMAIL PROTECTED] wrote: very nice - this fix is applied in r5314.  It's not every day someone   gives us a patch for strategies.py...have any more ? :) On Nov 20, 2008, at 9:47 PM, Yoann Roman wrote

[sqlalchemy] Invalid SQL for not None on relation attributes

2008-11-20 Thread Yoann Roman
I'm getting invalid SQL when I try to filter for records that have no matching related record in a one-to-one relationship using the not_ function. For example, with address being a relation from User: print User.id==None users.id IS NULL print not_(User.id==None) users.id IS NOT NULL print