Hello.

Why func.sum(some_table.c.bigintfield) returns Decimal ?
documents_table.c.sum has BigInteger type (postgresql table field has
bigint type)

the same issue I got with postgresql date_part func, when I extract
year or month I got Decimal result, not int....

>>> s = select([func.sum(documents_table.c.sum).label('payments_sum'), 
>>> func.sum(documents_table.c.payments).label('payments_count')])
>>> session.execute(s).fetchall()
2011-09-26 13:48:41,543 INFO sqlalchemy.engine.base.Engine SELECT
sum(documents.sum) AS payments_sum, sum(documents.payments) AS
payments_count
FROM documents
2011-09-26 13:48:41,543 INFO sqlalchemy.engine.base.Engine {}
[(Decimal('51788997139'), 8853396L)]

>>> s = select([cast(func.sum(documents_table.c.sum), 
>>> BigInteger).label('payments_sum'), 
>>> func.sum(documents_table.c.payments).label('payments_count')])
>>> session.execute(s).fetchall()
2011-09-26 13:48:56,243 INFO sqlalchemy.engine.base.Engine SELECT
CAST(sum(documents.sum) AS BIGINT) AS payments_sum,
sum(documents.payments) AS payments_count
FROM documents
2011-09-26 13:48:56,244 INFO sqlalchemy.engine.base.Engine {}
[(51788997139L, 8853396L)]

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to