[sqlalchemy] Functions on column properties

2014-06-18 Thread Mike Solomon
Hey all, First and foremost, thank you for this wonderful library! This is my first post to the list and I am very grateful for those who have taken the time to make sqlalchemy. I am using SQLalchemy as a backend for an object-oriented language I am developing. The way it works is that it

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-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 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 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