SQL Alchemy ResultProxy.rowcount should not be zero

前端 未结 2 1519
别跟我提以往
别跟我提以往 2020-12-20 13:13

Does anyone know how to get the row count from an SQL Alchemy query ResultProxy object without looping through the result set? The ResultProxy.rowcount attribute shows 0, I

2条回答
  •  甜味超标
    2020-12-20 13:41

    You could use this:

    rowcount = len(results._saved_cursor._result.rows)
    

    Then your code will be

    print '%s rows returned by query...\n' % rowcount
    print results.keys()
    

    Only tested 'find' queries

    It works for me.

提交回复
热议问题