Retrieving Data from MySQL in batches via Python

后端 未结 4 2006
日久生厌
日久生厌 2021-01-31 11:11

I would like to make this process in batches, because of the volume.

Here\'s my code:

 getconn = conexiones()
 con = getconn.mysqlDWconnect()
 with con:         


        
4条回答
  •  孤城傲影
    2021-01-31 11:50

    You can use

    SELECT id, date, product_id, sales FROM sales LIMIT X OFFSET Y;
    

    where X is the size of the batch you need and Y is current offset (X times number of current iterations for example)

提交回复
热议问题