Command for clear data table

Does anvil has command for clear data tables? only clear data, not delete whole table. In case I don’t want to perform this operation in data tables.

This removes all rows from a given data table:

app_tables.my_table.delete_all_rows()

Of course substitute “my_table” with the name of your table.

4 Likes

Where do we write this?

I’d write it in a function in a Server module or private Uplink program. Browser-side code, run by your App’s users, probably shouldn’t be erasing entire tables!