Skip to content

Commit 95ed7ad

Browse files
committed
fix build
1 parent 2d65221 commit 95ed7ad

2 files changed

Lines changed: 25 additions & 4 deletions

File tree

packages/google-cloud-bigtable/tests/system/data/test_system_async.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,27 @@ async def delete_rows(self):
114114
# under 4MB and minimizes transient network timeouts on live connections.
115115
chunk_size = 5000
116116
rows_list = list(self.rows)
117+
118+
# Check if the test target is an Authorized View
119+
is_authorized_view = "authorized_view_name" in self.target._request_path
120+
121+
if is_authorized_view:
122+
# For Authorized Views, we cannot use delete_from_row because it attempts
123+
# to delete families outside the view's scope. We must delete explicitly
124+
# from the allowed families we wrote to.
125+
mutations = [
126+
{"delete_from_family": {"family_name": TEST_FAMILY}},
127+
{"delete_from_family": {"family_name": TEST_AGGREGATE_FAMILY}},
128+
]
129+
else:
130+
mutations = [{"delete_from_row": {}}]
131+
117132
for i in range(0, len(rows_list), chunk_size):
118133
chunk = rows_list[i : i + chunk_size]
119134
request = {
120135
**self.target._request_path,
121136
"entries": [
122-
{"row_key": row, "mutations": [{"delete_from_row": {}}]}
123-
for row in chunk
137+
{"row_key": row, "mutations": mutations} for row in chunk
124138
],
125139
}
126140
# Await and consume the gRPC stream to guarantee execution

packages/google-cloud-bigtable/tests/system/data/test_system_autogen.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,20 @@ def delete_rows(self):
9696
if self.rows:
9797
chunk_size = 5000
9898
rows_list = list(self.rows)
99+
is_authorized_view = "authorized_view_name" in self.target._request_path
100+
if is_authorized_view:
101+
mutations = [
102+
{"delete_from_family": {"family_name": TEST_FAMILY}},
103+
{"delete_from_family": {"family_name": TEST_AGGREGATE_FAMILY}},
104+
]
105+
else:
106+
mutations = [{"delete_from_row": {}}]
99107
for i in range(0, len(rows_list), chunk_size):
100108
chunk = rows_list[i : i + chunk_size]
101109
request = {
102110
**self.target._request_path,
103111
"entries": [
104-
{"row_key": row, "mutations": [{"delete_from_row": {}}]}
105-
for row in chunk
112+
{"row_key": row, "mutations": mutations} for row in chunk
106113
],
107114
}
108115
stream = self.target.client._gapic_client.mutate_rows(request)

0 commit comments

Comments
 (0)