Peter Waller wrote: > Let's say I write something like: > > fixed_column = cast(my_column.op("/")(2**32), > Integer).label("fixed_column") > > print select([fixed_column]).where(fixed_column > 100) > > I get: > > SELECT CAST(my_column / :my_columnn_1 AS INTEGER) AS fixed_column > FROM table > WHERE CAST(my_column / :my_column_1 AS INTEGER) > :param_1 > > Is there any reason "fixed_column" is not re-used in the where statement? > Is > it possible to make this happen? It would make my statements much0 more > readable.
we don't do that by default since you'd be surprised how much trouble some backends have with it - the rules to decide when/when not are just too complex. Just use a free-floating element like "column('fixed_column', Integer)" to repeat the name. > > Thanks, > > - Peter > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to sqlalch...@googlegroups.com. > To unsubscribe from this group, send email to > sqlalchemy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.