[Sqlalchemy-tickets] Issue #3706: Text() with Group by causes 'TextClause' object has no attribute
Brought to you by:
zzzeek
From: kuthair <iss...@bi...> - 2016-05-05 20:08:46
|
New issue 3706: Text() with Group by causes 'TextClause' object has no attribute 'c' https://bitbucket.org/zzzeek/sqlalchemy/issues/3706/text-with-group-by-causes-textclause kuthair: I get the following error when trying to apply text() to a group_by clause. `query = query.group_by(text(group_by))` **Error:** 'TextClause' object has no attribute 'c' Without text(), I get the following warning: `SAWarning: Can't resolve label reference 'import_first_name, import...'; converting to text() (this warning may be suppressed after 10 occurrences)` Here's the stack trace of the error: ```File \"<string>\", line 2, in group_by\n File \"/Code/.api2.env/lib/python3.5/site-packages/sqlalchemy/orm/base.py\", line 201, in generate\n fn(self, *args[1:], **kw)\n File \"/Code/.api2.env/lib/python3.5/site-packages/sqlalchemy/orm/query.py\", line 1550, in group_by\n criterion = list(chain(*[_orm_columns(c) for c in criterion]))\n File \"/Code/.api2.env/lib/python3.5/site-packages/sqlalchemy/orm/query.py\", line 1550, in <listcomp>\n criterion = list(chain(*[_orm_columns(c) for c in criterion]))\n File \"/Code/.api2.env/lib/python3.5/site-packages/sqlalchemy/orm/base.py\", line 348, in _orm_columns\n return [c for c in insp.selectable.c]\nAttributeError: 'TextClause' object has no attribute 'c'\n"``` |