Thanks! Exactly what I needed.
-Original Message-
From: Ladislav Lenart [mailto:lenart...@volny.cz]
Sent: Wednesday, March 20, 2013 8:01 PM
To: sqlalchemy@googlegroups.com
Cc: Alexey Vihorev
Subject: Re: [sqlalchemy] Placeholder values
Hello.
I think you want this:
http://docs.sqlalchemy.org/en/rel_0_7/core/expression_api.html#sqlalchemy.sq
l.expression.literal_column
Basic usage example:
from sqlalchemy.sql.expression import literal_column
# Connect...
print Session.query(literal_column('42')) # prints: 'SELECT 42'
HTH,
Ladislav Lenart
On 20.3.2013 18:39, Alexey Vihorev wrote:
Hi!
I've got to unite two tables preserving some of their columns as
distinct, so to comply with the same number, same type requirement
of the UNION operator I use placeholder values, like this:
*SELECT*united.customer_id,
united.document_id,
*SUM*(united.debt_moved) *AS*debt_moved,
*SUM*(united.debt_total) *AS*debt_total,
*SUM*(debt_total -debt_moved) *AS*delta
*FROM*
(*SELECT*debt.customer_id,
debt.document_id,
debt.debt *AS*debt_total,
0.00*AS*debt_moved /--placeholder value/
*FROM*debt
*UNION**ALL**SELECT*debt_movement.customer_id,
debt_movement.document_id,
debt_movement.debt *AS*debt_moved,
0.00*AS*debt_total /-- placeholder value/
*FROM*debt_movement
*WHERE*debt_movement.date_time'04/03/2013') *AS*united
*GROUP**BY*customer_id,
document_id
But I found no obvious way to do that in SA. Any thoughts? Thanks!
--
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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.