# Bug: the "Max. numbers of rows deletion in a single call" limitation (via System Limitations) isnt based on the amount of rows you try to delete, but the amount of rows in the table instead

**URL:** <https://forum.seatable.com/t/bug-the-max-numbers-of-rows-deletion-in-a-single-call-limitation-via-system-limitations-isnt-based-on-the-amount-of-rows-you-try-to-delete-but-the-amount-of-rows-in-the-table-instead/3249>\
**Category:** Scripts (Python and JS)\
**Tags:** bug, limits\
**Created:** [February 23, 2024, 12:38pm UTC](https://forum.seatable.com/t/bug-the-max-numbers-of-rows-deletion-in-a-single-call-limitation-via-system-limitations-isnt-based-on-the-amount-of-rows-you-try-to-delete-but-the-amount-of-rows-in-the-table-instead/3249 "2024-02-23T12:38:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Somebuddy](https://forum.seatable.com/letter_avatar_proxy/v4/letter/s/a4c791/32.png) [@Somebuddy](https://forum.seatable.com/u/Somebuddy)\
**Post date:** [February 23, 2024, 12:38pm UTC](https://forum.seatable.com/t/bug-the-max-numbers-of-rows-deletion-in-a-single-call-limitation-via-system-limitations-isnt-based-on-the-amount-of-rows-you-try-to-delete-but-the-amount-of-rows-in-the-table-instead/3249/1 "2024-02-23T12:38:40Z")

</div>

this means deletion via batch api calls is not possible as soon as a table has more than 9999 rows.

this is the code I used to test this:

```auto
from seatable_api import Base, context
base = Base(context.api_token, context.server_url)
base.auth() 

write_limit = 1000
read_limit = 10000
delete_limit = 10000

def get_all_rows():
    query = "select _id from Table1 limit {} offset {}"

    rows = []
    index = 0

    while True:
        query_formatted = query.format(read_limit, index * read_limit)
        query_result = base.query(query_formatted)
        rows.extend(query_result)    
        index += 1
        if len(query_result) < 10000:
            break
    
    return [row["_id"] for row in rows]

def add(amount):
    rows_data = [{"filler": "filled"} for _ in range(amount)]

    for i in range(0, len(rows_data), write_limit): 
        slice = rows_data[i:i+write_limit]
        base.batch_append_rows("Table1", slice)

def remove():
    row_ids = get_all_rows()
    for i in range(0, len(row_ids), delete_limit):
        slice = row_ids[i:i+delete_limit]
        base.batch_delete_rows("Table1", row_ids)
    

 
remove()
#add(9999)

```

---

<div class="post-metadata">

**Author:** ![daniel.pan](https://forum.seatable.com/user_avatar/forum.seatable.com/daniel.pan/32/13_2.png) [@daniel.pan](https://forum.seatable.com/u/daniel.pan)\
**Post date:** [February 24, 2024, 12:59am UTC](https://forum.seatable.com/t/bug-the-max-numbers-of-rows-deletion-in-a-single-call-limitation-via-system-limitations-isnt-based-on-the-amount-of-rows-you-try-to-delete-but-the-amount-of-rows-in-the-table-instead/3249/2 "2024-02-24T00:59:53Z")

</div>

We will check the issue in the next week.

---

<div class="post-metadata">

**Author:** ![r350178982](https://forum.seatable.com/user_avatar/forum.seatable.com/r350178982/32/3192_2.png) [@r350178982](https://forum.seatable.com/u/r350178982)\
**Post date:** [March 20, 2024, 8:30am UTC](https://forum.seatable.com/t/bug-the-max-numbers-of-rows-deletion-in-a-single-call-limitation-via-system-limitations-isnt-based-on-the-amount-of-rows-you-try-to-delete-but-the-amount-of-rows-in-the-table-instead/3249/3 "2024-03-20T08:30:45Z")

</div>

Hi,  
I think there might be some problems in the remove function. The second parameters you use in base.batch\_delete\_rows should be `slice` instead of `row_ids` which will take account all rows. It should be like `base.batch_delete_rows("Table1", slice)`

On the other hand, by defaut for the batch-delete-rows API, there is a limitation of 10000 rows for deletion operation one time. You may get an error message (status code of 413)if you exceeds the limits.

In your case , please print some message `print(len(row_ids))` to check the problems.

---

<div class="post-metadata">

**Author:** ![system](https://forum.seatable.com/uploads/default/original/1X/04603423fe81a46c321283663086c475429e8ccb.png) [@system](https://forum.seatable.com/u/system)\
**Post date:** [May 10, 2024, 10:00am UTC](https://forum.seatable.com/t/bug-the-max-numbers-of-rows-deletion-in-a-single-call-limitation-via-system-limitations-isnt-based-on-the-amount-of-rows-you-try-to-delete-but-the-amount-of-rows-in-the-table-instead/3249/4 "2024-05-10T10:00:05Z")

</div>

Closed on May 10, 2024, 10:00am UTC

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
