Re: [sqlalchemy] column_property for correlated subquery

2013-03-19 Thread Michael Bayer
I think we need to just get column_property to work as a string with declarative. Sent from my iPhone On Mar 19, 2013, at 6:10 AM, millerdev miller...@gmail.com wrote: __declare_last__ works. Thanks Mike. Would it make sense to add a property decorator similar to @declared_attr (maybe

[sqlalchemy] column_property for correlated subquery

2013-03-18 Thread millerdev
Hi, Using declarative here, and I'm trying to create a column_property with a correlated subquery that returns a count of records with a matching value in some other column. Here's what I've tried. Option 1 is the best, option 2 is ugly but second best, option 3 is not a good option since

Re: [sqlalchemy] column_property for correlated subquery

2013-03-18 Thread Michael Bayer
the typical hook for this kind of thing is __declare_last__, works after everything has been compiled. you might have an easier time also (or might not matter) if you build against the Table (i.e. Foo.__table__.alias(), etc.) instead of firing up the class with aliased(Foo), but if you're in