-----Original Message----- From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On Behalf Of Werner Sent: Wednesday, January 23, 2013 2:00 PM To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] Couple of questions about filtering...
On 23/01/2013 07:47, Alexey Vihorev wrote: > Ok, I've set up a complete test case: http://pastebin.com/W08w6Hg6 That throws an exception: TypeError: getattr(): attribute name must be string File "h:\devProjectsT\aaTests\aaMisc\AlexeyVihorev\sahybrid-org.py", line 67, in <module> res = s.query(Payable).filter(Payable.value==order).all() #this does not File "c:\Python27\Lib\site-packages\sqlalchemy-0.7.9-py2.7.egg\sqlalchemy\ext\hyb rid.py", line 681, in __get__ return self.expr(owner) File "h:\devProjectsT\aaTests\aaMisc\AlexeyVihorev\sahybrid-org.py", line 46, in value return getattr(self, self.type) Indeed it does! That's the whole point :) >I am not an expert on these things but shouldn't you maybe use the following instead of hybrid_property: >http://docs.sqlalchemy.org/en/latest/orm/inheritance.html Thanks for the suggestion, but I can't: sometimes the entities linked are completely unrelated, sometimes there need to be several of such 'unions' with different contents, etc. That's why I'm trying to implement something more universal. And yes, I've read this http://techspot.zzzeek.org/2007/05/29/polymorphic-associations-with-sqlalche my/ -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@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.