Changeset f85e800 in rattail


Ignore:
Timestamp:
07/29/2020 12:09:53 AM (3 years ago)
Author:
Lance Edgar <lance@…>
Branches:
master
Children:
e16175f
Parents:
11a1c8c
Message:

Be smarter about deleting rows, when deleting batch

this seems to be more efficient than the previous attempt...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rattail/batch/handlers.py

    r11a1c8c rf85e800  
    733733
    734734            def delete(row, i):
    735                 batch.data_rows.remove(row)
    736735                session.delete(row)
    737736                if i % 200 == 0:
     
    740739            self.progress_loop(delete, batch.data_rows, progress,
    741740                               message="Deleting rows from batch")
     741
     742            # even though we just deleted all rows, we must also "remove" all
     743            # rows explicitly from the batch; otherwise when the batch itself
     744            # is deleted, SQLAlchemy may complain about an unexpected number of
     745            # rows being deleted
     746            del batch.data_rows[:]
    742747
    743748    def setup_clone(self, oldbatch, progress=None):
Note: See TracChangeset for help on using the changeset viewer.