Thank you, my friend. Sorry for the incorrect example which I provide
On Monday, March 2, 2020 at 8:37:00 PM UTC+5:30, Balukrishnan wrote:
>
> Hi friends,
>
> I am using some expressions in the select values itself like this.
>
> data = select([testb.c.var1.op('&')(5)]).From(testb).execute()
>
>
> But the corresponding SQL generated is
>
> SELECT (testb.var1 & $1) != $2 AS anon_1 FROM testb, Args: (1, 0)
>
>
> I can't label the column-like testb.c.var1.op('&')(5).label('Var'). Why
> this happening and how can I label that column with a valid name. Please
> help.
>
> also tried (but getting error),
>
> - data =
> select([testb.c.var1.op('&')(5).label('VAR')]).From(testb).execute()
> - data =
> select([testb.c.var1.label('VAR').op('&')(5)]).From(testb).execute()
> - data =
> select([testb.c.var1.alias('VAR').op('&')(5)]).From(testb).execute()
> - data =
> select([testb.c.var1.op('&')(5).alias('VAR')]).From(testb).execute()
>
>
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/sqlalchemy/db07ca08-556d-40eb-a6af-0f54c48937d1%40googlegroups.com.