Ejemplo n.º 1
0
    def test_batch(self):
        rows = get_fake_rows(100)
        batch_size = 5
        batches_expected = math.ceil(len(rows) / batch_size)

        bulk = BulkInsertFromIterator(TestTable, rows, columns_t, batch_size)
        batches = []
        for batch in bulk.batch_execute(get_mock_connection):
            batches.append(batch)

        assert len(batches) == batches_expected