Re: [sqlalchemy] Functions on column properties

2014-06-19 Thread Mike Solomon
not looking deeply but the hybrid you have in prop_3 doesn't seem to have any relationship to the base set of rows you're getting from fractions. it returns multiple rows because statement2 isn't using any aggregates. How about a straight SQL string? what SQL do you expect? these are

Re: [sqlalchemy] Functions on column properties

2014-06-19 Thread Mike Bayer
On 6/19/14, 4:09 AM, Mike Solomon wrote: It's difficult to issue a straight SQL string for the hybrid property itself because sorry, I meant, please write the query *that you really want* as a SQL string. Don't use SQLAlchemy. It's better to work in that direction. If you don't know

Re: [sqlalchemy] Functions on column properties

2014-06-19 Thread Mike Solomon
Le jeudi 19 juin 2014 16:10:19 UTC+3, Michael Bayer a écrit : On 6/19/14, 4:09 AM, Mike Solomon wrote: It's difficult to issue a straight SQL string for the hybrid property itself because sorry, I meant, please write the query *that you really want* as a SQL string.

Re: [sqlalchemy] Functions on column properties

2014-06-19 Thread Mike Bayer
On 6/19/14, 2:41 PM, Mike Solomon wrote: Le jeudi 19 juin 2014 16:10:19 UTC+3, Michael Bayer a écrit : On 6/19/14, 4:09 AM, Mike Solomon wrote: It's difficult to issue a straight SQL string for the hybrid property itself because sorry, I meant,

Re: [sqlalchemy] Functions on column properties

2014-06-19 Thread Mike Solomon
Le jeudi 19 juin 2014 22:07:14 UTC+3, Michael Bayer a écrit : So to the extent that 1.0 * num / den is a column-based expression you like to use in your query, it's a good candidate for a hybrid or column_property (deferred one in case you don't want to load it unconditionally). But as

Re: [sqlalchemy] Functions on column properties

2014-06-18 Thread Mike Solomon
Le mercredi 18 juin 2014 22:03:33 UTC+3, Michael Bayer a écrit : if you can show the SQL you expect that would help. it seems in your SO question you want a subquery, you'd have to define that: class Holder(..): some_prop = column_property(select([func.max(1 * col1 / col2)]))

Re: [sqlalchemy] Functions on column properties

2014-06-18 Thread Mike Bayer
On 6/18/14, 4:50 PM, Mike Solomon wrote: Le mercredi 18 juin 2014 22:03:33 UTC+3, Michael Bayer a écrit : if you can show the SQL you expect that would help. it seems in your SO question you want a subquery, you'd have to define that: class Holder(..): some_prop =