sqlalchemy core: using scalarselect in "with_only_columns"

Issue #2270 resolved
Former user created an issue

I may have found a bug when using a scalar_select in the with_only_columns expression from an enclosing select.

The problem is, a special case for scalar selects try to evaluates them in a boolean context, which is not defined for scalars.

Please see the attached test case, alongside with the proposed patch.

Sorry if this issue has already been reported, but I could not find it.

Thank you.

Comments (5)

  1. Mike Bayer repo owner

    yes that's totally a bug, this is for 0.6.9/0.7.3. I apologize for the usage of "x AND y or Z" - up until 0.7 we've supported Python 2.4 which doesn't have "X if Y else Z" syntax. SQLA 0.8 will move up to Python 2.5. Thanks for the patch !

  2. Log in to comment