Hello All,
I'm trying to use a ColumnProperty to retrieve a field from a ManyToMany relationship. The following code, which is added to the Movie class, reproduces the problem in the Videostore tutorial application.
@ColumnProperty
def no_tags( self ):
from_obj = orm.join(Movie,Tag,Movie.tags)
return sql.select(sql.func.count([Tag.id)],from_obj=from_obj,
whereclause=sql.and_(Movie.id == self.id ))
I expect a different number for each row/Movie. However, I do get the same value for each row.
Does ColumnProperty work with ManyToMany relationships and joins? Am I doing something wrong here? Do I possibly need to explicitly use the cross-link table?