How do I translate something like this into SQLAlchemy?
select x - y as difference...
I know how to do:
x.label('foo')
...but I'm not sure where to put the ".label()" method call below:
select ([table.c.x - table.c.y], ...
How do I translate something like this into SQLAlchemy?
select x - y as difference...
I know how to do:
x.label('foo')
...but I'm not sure where to put the ".label()" method call below:
select ([table.c.x - table.c.y], ...
The ColumnElement
method is just a helper; canonical usage is along the lines of the following:
select([sql.expression.label('foo', table.c.x - table.c.y), ...])
See the documentation.