[sqlalchemy] Re: Selectable/subquery for a (scalar) column?

2007-04-30 Thread Michael Bayer
On Apr 30, 1:11 pm, Gaetan de Menten [EMAIL PROTECTED] wrote: There is (at least) one problem remaining though: subqueries do not get correlated correctly. This is because the table in the main query is aliased and the one in the subquery is not and that the correlator in the Select class

[sqlalchemy] Re: Selectable/subquery for a (scalar) column?

2007-04-29 Thread Michael Bayer
turns out scalar columns already worksince they are just...columns ! which ColumnProperty already handles. any old SA version will allow the test script to work, if you use ColumnProperty explicitly along with two small fixes in sql.py. in the trunk ive added those fixes, as well

[sqlalchemy] Re: Selectable/subquery for a (scalar) column?

2007-04-26 Thread Gaetan de Menten
On 4/26/07, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 26, 2007, at 4:40 AM, Gaetan de Menten wrote: - you have an aggregate function there. wheres the GROUP BY ? not just of the main table's columns but any other columns named for eager loads. It's unneeded in my

[sqlalchemy] Re: Selectable/subquery for a (scalar) column?

2007-04-26 Thread Michael Bayer
On Apr 26, 2007, at 4:40 AM, Gaetan de Menten wrote: - the biggest picture not here - its read only ! It's obviously meant to be that way... So I don't see a problem here. We might want to add an exception when people try to change it, but that shouldn't be too hard. Besides, I

[sqlalchemy] Re: Selectable/subquery for a (scalar) column?

2007-04-26 Thread Michael Bayer
On Apr 26, 2007, at 9:46 AM, Gaetan de Menten wrote: But nevermind the patch I did. I realize now it's pretty much useless. But what about the approach I discussed in my previous mail? (using what is in the relation loaders but without creating the instances) well as ive said, id like it

[sqlalchemy] Re: Selectable/subquery for a (scalar) column?

2007-04-25 Thread Gaetan de Menten
Ok, I'm quite a bit stubborn at times, so I implemented this the way I thought because I think it makes much more sense this way. Attached is an experimental (as usual) patch to add a StatementProperty, so that you can define stuff like: mapper(Tag, tags_table, properties={ 'query_score':

[sqlalchemy] Re: Selectable/subquery for a (scalar) column?

2007-04-24 Thread Gaetan de Menten
On 4/24/07, Gaetan de Menten [EMAIL PROTECTED] wrote: On 4/23/07, Michael Bayer [EMAIL PROTECTED] wrote: On Apr 23, 2007, at 3:49 PM, Gaetan de Menten wrote: Hello there, In a mapped object, is there any way to map a scalar attribute to an arbitrary selectable/subquery?

[sqlalchemy] Re: Selectable/subquery for a (scalar) column?

2007-04-24 Thread Michael Bayer
On Apr 24, 2007, at 4:44 AM, Gaetan de Menten wrote: the next way is to do it almost the same as Jonathan's blog says to do it, except youd map the relation to some intermediary class like Score, and then use AssociationProxy to apply the scalar property to the class. I thought about

[sqlalchemy] Re: Selectable/subquery for a (scalar) column?

2007-04-23 Thread Michael Bayer
On Apr 23, 2007, at 3:49 PM, Gaetan de Menten wrote: Hello there, In a mapped object, is there any way to map a scalar attribute to an arbitrary selectable/subquery? Jonathan Ellis demonstrated how to do that for relations on this page: