Using func.sum(BinaryExp), returns a boolean instead of a sum (wasn't the case in 1.1.12)
See original GitHub issueMigrated issue, originally created by Bastien Gérard (@bagerard)
Hi, First of all, we are using MySQL 5.6
After switching from sqlalchemy 1.1.12 to 1.2.2, we observed that one of our test failed.
In fact the following scenario should return a RowProxy with the values being the sum but the values are boolean instead.
from sqlalchemy import select
from sqlalchemy.sql.functions import func
engine, tbl, col = ...
sel = select([func.sum(col.is_(None))])
print sel # SELECT sum(smart_result.signal_predicted IS NULL) AS sum_1 FROM smart_result
row = engine.execute(sel).fetchone()
print dict(row) # {u'sum_1': True}
# And if I execute it manually:
r = engine.execute('SELECT sum(smart_result.signal_predicted IS NULL) AS sum_1 FROM smart_result')
print r.fetchall() # [(Decimal('120'),)]
I don’t know if it could be related but by printing row._key_map, I see references to “<function sqlalchemy.cprocessors.int_to_boolean>”.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
Sqlalchemy sum of true - Stack Overflow
I thought about nullable(boolean) ( boolean column without default value). WHERE value2 != TRUE and WHERE value2 IS NOT TRUE . In any...
Read more >Solved: sum case expression returning boolean values
Re: sum case expression returning boolean values Please provide details on which value, MS1 or MS2, should be returned. Your current code or ......
Read more >Game Theory, Alive
Proof of Theorem 1.1.12. Define Z to be those positions with Nim-sum zero. We will show that: (a) From every position in Z,...
Read more >powerful Python data analysis toolkit - Pandas
When converting a dataframe to HTML it used to return Empty DataFrame. This special case has been removed, instead a header with the...
Read more >micropython-docs.pdf
This chapter describes modules (function and class libraries) which are built into MicroPython. This documentation in general aspires to describe all ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Bastien Gérard (@bagerard) wrote:
As a workaround, note that the following works:
Changes by Michael Bayer (@zzzeek):