On Tue, 2013-10-01 at 20:53 -0400, Michael Bayer wrote:
>  is it that you want the column property declared inside the class
> declaration?  you can use __declare_last__ as one option, here is
> that:
> class Project(Base):
...
>     @classmethod
>     def __declare_last__(cls):
>         p_alias = cls.__table__.alias()
>         cls.project_count = column_property(
>             select([func.count(p_alias.c.object_id)]).\
>                 where(p_alias.c.parent_id == cls.object_id).
>             as_scalar()
>             )

Yes, this is exactly what I was looking for; otherwise the definition of
the model definition [it is a complex model] gets sort of smeared.  This
works perfectly.


-- 
Adam Tauno Williams <mailto:awill...@whitemice.org> GPG D95ED383
Systems Administrator, Python Developer, LPI / NCLA

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to