self.cr.execute(sql, )
        # res = self.cr.fetchmany(1000)
        while True:
            res = self.cr.fetchmany(1000)
            print(len(res),res)
            if not res:
                break
        return res
  1. fetchmany 和fetchall() 类似,只是可以读取指定行数的数据量,当指定数据量小于实际数据量时,可以重复读取
  2. 如果使用fetchall() 来读取数据,如果数据量太大,放在一个列表中,可能放不下,就可以使用fetchmany()分批读取的方式.

相关文章:

  • 2022-01-18
  • 2021-07-01
  • 2022-01-17
  • 2021-11-29
  • 2022-12-23
  • 2022-02-20
  • 2021-07-29
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-23
  • 2022-12-23
  • 2021-12-18
  • 2021-12-18
  • 2021-09-22
  • 2022-12-23
相关资源
相似解决方案