On Tue, Jun 26, 2018 at 8:09 AM, Eugene Prikazchikov <[email protected]> wrote:
> Traceback:
>
> Traceback (most recent call last):
> File "1.py", line 15, in <module>
> s.query(A).options(with_expression(A.expr, text('x')))
> File
> ".venv/lib/python3.6/site-packages/sqlalchemy/orm/strategy_options.py", line
> 1438, in with_expression
> False, {"expression": expression})
> File
> ".venv/lib/python3.6/site-packages/sqlalchemy/orm/strategy_options.py", line
> 494, in _from_keys
> opt = meth(opt, all_tokens[-1], **kw)
> File
> ".venv/lib/python3.6/site-packages/sqlalchemy/orm/strategy_options.py", line
> 1425, in with_expression
> _orm_full_deannotate(expression))
> File "<string>", line 1, in <lambda>
> File ".venv/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", line
> 4181, in _labeled
> return element.label(None)
> AttributeError: 'TextClause' object has no attribute 'label'
this is probably a bug in that text() should be accepted. However
it's looking for a column based expression, so instead of text() use
literal_column("x").
>
>
> --
> SQLAlchemy -
> The Python SQL Toolkit and Object Relational Mapper
>
> http://www.sqlalchemy.org/
>
> To post example code, please provide an MCVE: Minimal, Complete, and
> Verifiable Example. See http://stackoverflow.com/help/mcve for a full
> description.
> ---
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.