Hi! Maybe this is a pretty weird use case (please let me know if there is a better way to do this).
What I wanted was just to store an ordered list of many-to-many relationships. To achieve this, I used an special intermediate table with an extra field for ordering. Then I write some custom SQL queries to do the join using sqlbuilder.table (Table instance) and friends.
The problem is I'm getting a TypeError ("TypeError: unhashable instance") when doing that, because Table and Field don't have the __hash__ magic method (and for the records, none SQLExpression does either).
Well, long story short, this is fixed by just adding the __hash__ method to SQLExpression class. Here is the patch and a simple testcase.
Again, please tell me if there is a cleaner way to achieve this with SQLObject.
Log in to post a comment.