[sqlalchemy] Re: Using custom function expression throws 'TypeError: an integer is required' in orm query

2011-07-04 Thread Adrian
I found the problem now - the __hash__() function I had did not return an integer, it returned a tuple of the composite primary key. I changed it now and it works, thanks for your help! On Jul 4, 8:50 am, Adrian wrote: > Yes, the __eq__() and __hash__() functions are overridden to compare > the p

[sqlalchemy] Re: Using custom function expression throws 'TypeError: an integer is required' in orm query

2011-07-04 Thread Adrian
Yes, the __eq__() and __hash__() functions are overridden to compare the primary keys (e.g. self.id==other.id, or hash(self.id)). The orm query works as expected once I remove them from the Entity class definition. On Jul 1, 4:03 pm, Michael Bayer wrote: > does your Entity class have some overrid

Re: [sqlalchemy] Re: Using custom function expression throws 'TypeError: an integer is required' in orm query

2011-07-01 Thread Michael Bayer
does your Entity class have some overridden __eq__(), __cmp__(), __hash__() on it ? I think there might be an issue here but I need a lot more specifics. On Jul 1, 2011, at 6:34 AM, Adrian wrote: > I just tested it and session.execute(query.statement) returns the > proper resultset. The 'sim

[sqlalchemy] Re: Using custom function expression throws 'TypeError: an integer is required' in orm query

2011-07-01 Thread Adrian
I just tested it and session.execute(query.statement) returns the proper resultset. The 'similarity' functions returns REAL. --- In [13]: query.all() --- TypeError Traceback (most recent call l