id look at prop = MyClass.someattribute.property, use isinstance(prop, PropertyLoader) to determine a relation and not a scalar, combined with getattr(prop, "direction") == sqlalchemy.orm.sync.MANYTOMANY, ONETOMANY, etc. to get the type of join.
On Dec 3, 2007, at 3:43 PM, Brendan Arnold wrote: > > hi there, > > i'd like a way to determine if an attribute of an orm object is: > > a:) a sqlalchemy generated list of objects (i.e. many-to-many) > b:) a single sqlalchemy joined object (i.e.one-to-many) > c:) a 'scalar' loaded from the database (i.e. a string, float, > integer) > > at present i'm copying the text generated by > 'type(orm_obj.joined_list)' to determine a: and a 'type(float, int > etc.)' for c:, whats left is b. > > this seems shakey, is there a better way? are there some 'types' > defined in sqlalchemy? > > brendan > > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---