Alexander, Do you want to know how many children some Parent instance has? If that's what you're looking for then len(parent.children) is one of many ways to get answer. It is probably the best one if children are eager loaded but it is most likely the worst one if they are lazy loaded.
Cheers Alex On Dec 5, 9:30 am, Alexander Zhabotinskiy <[email protected]> wrote: > There are two tables like: > > *********************************************** > left_table = Table('left', metadata, > Column('id', Integer, primary_key=True)) > > right_table = Table('right', metadata, > Column('id', Integer, primary_key=True)) > > association_table = Table('association', metadata, > Column('left_id', Integer, ForeignKey('left.id')), > Column('right_id', Integer, ForeignKey('right.id')), > ) > > mapper(Parent, left_table, properties={ > 'children': relation(Child, secondary=association_table) > > }) > > mapper(Child, right_table) > *********************************************** > > What is the best way to count "right_id" in association_table? I need > to khow how many right_id relations. -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
