[sqlalchemy] Re: @comparable_using
I got around this by switching to declarative and declaring my property like this: _id = column_property(Column(id,Integer,primary_key=True), comparator_factory=some_comparator_factory()) And then used @synonym_for for the getter: @synonym_for(_id) @property def id(self): return some_function(self._id) I'm still not sure what was wrong with my original code, so would be interested in any comments, for academic reasons. Thank you! Matthew -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
Re: [sqlalchemy] Re: @comparable_using
On Mar 21, 2010, at 6:20 PM, Matthew wrote: I got around this by switching to declarative and declaring my property like this: _id = column_property(Column(id,Integer,primary_key=True), comparator_factory=some_comparator_factory()) And then used @synonym_for for the getter: @synonym_for(_id) @property def id(self): return some_function(self._id) I'm still not sure what was wrong with my original code, so would be interested in any comments, for academic reasons. your original test appeared to have a class descending from object. comparable_using applies to declarative classes. If you were using mapper(), you'd take the output from comparable_using and pass it to the properties dictionary of mapper() - but more likely you'd use comparable_property() directly pass your comparator straight in to column_property(), as introduced in http://www.sqlalchemy.org/docs/mappers.html#custom-comparators and linking to an example at http://www.sqlalchemy.org/docs/reference/orm/mapping.html#sqlalchemy.orm.comparable_property . Thank you! Matthew -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
Re: [sqlalchemy] Re: @comparable_using
After fixing my cutpaste problem I just get DB2 sql errors from the sample code. I'm going to turn on some more logging in db2 and see what is actually reaching it. Kevin Matthew wrote: I got around this by switching to declarative and declaring my property like this: _id = column_property(Column(id,Integer,primary_key=True), comparator_factory=some_comparator_factory()) And then used @synonym_for for the getter: @synonym_for(_id) @property def id(self): return some_function(self._id) I'm still not sure what was wrong with my original code, so would be interested in any comments, for academic reasons. Thank you! Matthew -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.