How to fetch more than 1000?

后端 未结 16 1997
囚心锁ツ
囚心锁ツ 2020-11-28 04:13

How can I fetch more than 1000 record from data store and put all in one single list to pass to django?

16条回答
  •  情话喂你
    2020-11-28 04:32

    JJG: your solution above is awesome, except that it causes an infinite loop if you have 0 records. (I found this out while testing some of my reports locally).

    I modified the start of the while loop to look like this:

    while count % 1000 == 0:
        current_count = query.count()
        if current_count == 0:
            break
    

提交回复
热议问题