def get_count ( self , query ) : count_q = query . statement . with_only_columns ( [ func . count ( ) ] ) . order_by ( None ) count = query . session . execute ( count_q ) . scalar ( ) return count
sum results of a query python sqlalchemy
Returns a number of query results . This is faster than . count () on the query
def get_count(self, query):
        """
        Returns a number of query results. This is faster than .count() on the query
        """
        count_q = query.statement.with_only_columns(
            [func.count()]).order_by(None)
        count = query.session.execute(count_q).scalar()
        return count