简体   繁体   English

如何在BigTable GCP中删除过滤的行

[英]How do I delete filtered rows in BigTable GCP

I trying to delete filtered rows in BigTable. 我试图删除BigTable中的过滤行。

I have a table that has an empty value in a cell that I would like to remove the row from the table, I wrote a filter that select the relevant rows, but when I try to delete the rows, I get an error. 我有一个表格,该表格的单元格中有一个空值,我想从表格中删除该行,我编写了一个过滤器来选择相关的行,但是当我尝试删除这些行时,出现错误。 enter code hereAttributeError: 'PartialRowData' object has no attribute 'delete'

I would like to know how should I Filter the relevant rows that base on the filter and delete them. 我想知道如何过滤基于过滤器的相关行并将其删除。

My code wrote in Python 我的代码是用Python编写的

col1_filter = row_filters.ColumnQualifierRegexFilter(b'customerId')
label1_filter = row_filters.ValueRegexFilter('')
chain1 = row_filters.RowFilterChain(filters=[col1_filter, label1_filter])

partial_rows = table.read_rows(filter_=chain1)

for row in partial_rows:
    row.delete()

You get that error because the PartialRowsData does not have a delete function. 您收到该错误,因为PartialRowsData没有删除功能。 You have to create a row from it (eg DirectRow ), than you can call the delete function or delete_cell function on it. 您必须从中创建一行(例如DirectRow ),然后才能在其上调用delete函数或delete_cell函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM