On May 18, 2011, at 1:13 AM, Michael Bayer wrote:
>
>
> now that is interesting, and its a bug, and why its unusual is because you've
> got a column_property() deriving from another column_property(). But the bug
> is interestingly a very simple one inside the select() construct. I still
> have to figure out how to fix it. Here's a workaround for the moment:
>
> author_name = column_property(
> select(
> [Author.name.__clause_element__().element],
> author_id == Author.id,
> ).label('author_name')
> )
yeah pretty freaky one, in that this is really old code, its definitely wrong,
and this case has never come up - the fix is teeny:
diff -r fc52837f0986 lib/sqlalchemy/sql/expression.py
--- a/lib/sqlalchemy/sql/expression.py Sat May 14 14:31:29 2011 -0400
+++ b/lib/sqlalchemy/sql/expression.py Wed May 18 01:21:51 2011 -0400
@@ -3815,7 +3815,7 @@
def _make_proxy(self, selectable, name = None):
if isinstance(self.element, (Selectable, ColumnElement)):
- e = self.element._make_proxy(selectable, name=self.name)
+ e = self.element._make_proxy(selectable, name=name or self.name)
else:
e = column(self.name)._make_proxy(selectable=selectable)
I just need to write some tests and that'll be in probably tomorrow, its ticket
2167, thanks for the report !
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.