[sqlalchemy] Re: I tried many different ways to get the sum of the differences of two columns in a table with sqlalchemy, but always end up with errors:

2018-06-04 Thread Hongqi Jia
m/loading.py", line *78*, in instances for row in fetch] - File "/usr/local/lib/python2.7/site-packages/sqlalchemy/sql/sqltypes.py", line *1717*, in process return value - epoch TypeError: unsupported operand type(s) for -: 'Decimal' and

[sqlalchemy] I tried many different ways to get the sum of the differences of two columns in a table with sqlalchemy, but always end up with errors:

2018-06-04 Thread Hongqi Jia
Here is how I define the query: _query = self.session.query(self.model.type, func.sum(case(value=self.model.final_status, whens={'SUCCESS': (self.model.end_time - self.model.start_time).total_seconds()}, else_=None) Here the end_time and start_time are columns of DateTime type. Here is the e