Search code examples
google-cloud-bigtable

Is it possible to remove all rows with a given prefix without deleting each one individually?


I have some records in a Bigtable table that we "soft deleted" i.e. we prefixed the rowkey with deleted#. We now need to get rid of all of them, is there an easy way to do this without writing a script to find them all and delete them one by one?

I was hoping I could use cbt deleteallrows but I don't want to delete all the rows in the table, only those with prefix deleted#.


Solution

  • No, there is no support for this in the cbt tool, so you would have to write a script or a program for this like the one you can find here.

    You can check out reading data with a prefix here with a python example and then delete it from there.

    When doing the readrow scan, you may want to filter out everything except the rowkey, so there isn't as much load on your server and application. You can do that with the cells per row filter and just set that to 1.

    It could also be helpful to check this other similar case.