Delete all rows on spotfire Data Table Iron python
Hi all, I was looking for a way to delete rows in my Data table on SPOTFIRE and I didn't find a proper way to do it.
I tried to code a script to do it, but It's too slow and I have more the 20k rows to be deleted.
Does someone have an idea why it's too slow and if there is another way to do (a faster way)
from Spotfire.Dxp.Data import RowSelection table=Document.Data.Tables["my Table name"] i=0 for row in table.GetRows(): i+=1 rowToDelete=Document.Data.Tables["my Table name"].Select("[index]="+`i`).AsIndexSet() Document.Data.Tables["my Table name"].RemoveRows(RowSelection(rowToDelete))
Hi sandeep kumar - I don't have any experience working with Spotfire, but I know many APIs have endpoints that allow you to perform bulk CRUD operations rather than going one-by-one. I think the way the script is written right now it performs a fully atomic delete operation for each row, which can be slow when done at the scale you're talking about. Instead, my suggestion would be to explore:
1) Looking into the Spotfire API to see if you can perform a bulk delete operation
2) Performing a conditional delete operation using SQL within Spotfire itself
Hope that helps - sorry we can't be of more help here.Reply