@@ -181,12 +181,43 @@ def row_key(self):
181
181
"""
182
182
return self ._row_key
183
183
184
+ def _get_cells_no_copy (self , column_family_id , column ):
185
+ """Get a time series of cells stored on this instance.
186
+
187
+ Args:
188
+ column_family_id (str): The ID of the column family. Must be of the
189
+ form ``[_a-zA-Z0-9][-_.a-zA-Z0-9]*``.
190
+ column (bytes): The column within the column family where the cells
191
+ are located.
192
+
193
+ Returns:
194
+ List[~google.cloud.bigtable.row_data.Cell]: The cells stored in the
195
+ specified column.
196
+
197
+ Raises:
198
+ KeyError: If ``column_family_id`` is not among the cells stored
199
+ in this row.
200
+ KeyError: If ``column`` is not among the cells stored in this row
201
+ for the given ``column_family_id``.
202
+ """
203
+ try :
204
+ column_family = self ._cells [column_family_id ]
205
+ except KeyError :
206
+ raise KeyError (_MISSING_COLUMN_FAMILY .format (column_family_id ))
207
+
208
+ try :
209
+ cells = column_family [column ]
210
+ except KeyError :
211
+ raise KeyError (_MISSING_COLUMN .format (column , column_family_id ))
212
+
213
+ return cells
214
+
184
215
def get_cell (self , column_family_id , column , index = 0 ):
185
216
"""Get a single cell stored on this instance.
186
217
187
218
.. note::
188
219
189
- This returns a copy of the actual ``Cell`` (so that the
220
+ This returns a copy of the actual cell (so that the
190
221
caller cannot mutate internal state).
191
222
192
223
Args:
@@ -210,15 +241,7 @@ def get_cell(self, column_family_id, column, index=0):
210
241
in this row for the given ``column_family_id``, ``column``
211
242
pair.
212
243
"""
213
- try :
214
- column_family = self ._cells [column_family_id ]
215
- except KeyError :
216
- raise KeyError (_MISSING_COLUMN_FAMILY .format (column_family_id ))
217
-
218
- try :
219
- cells = column_family [column ]
220
- except KeyError :
221
- raise KeyError (_MISSING_COLUMN .format (column , column_family_id ))
244
+ cells = self ._get_cells_no_copy (column_family_id , column )
222
245
223
246
try :
224
247
cell = cells [index ]
@@ -230,6 +253,33 @@ def get_cell(self, column_family_id, column, index=0):
230
253
231
254
return copy .deepcopy (cell )
232
255
256
+ def get_cells (self , column_family_id , column ):
257
+ """Get a time series of cells stored on this instance.
258
+
259
+ .. note::
260
+
261
+ This returns a copy of the actual cells (so that the
262
+ caller cannot mutate internal state).
263
+
264
+ Args:
265
+ column_family_id (str): The ID of the column family. Must be of the
266
+ form ``[_a-zA-Z0-9][-_.a-zA-Z0-9]*``.
267
+ column (bytes): The column within the column family where the cells
268
+ are located.
269
+
270
+ Returns:
271
+ List[~google.cloud.bigtable.row_data.Cell]: The cells stored in the
272
+ specified column.
273
+
274
+ Raises:
275
+ KeyError: If ``column_family_id`` is not among the cells stored
276
+ in this row.
277
+ KeyError: If ``column`` is not among the cells stored in this row
278
+ for the given ``column_family_id``.
279
+ """
280
+ cells = self ._get_cells_no_copy (column_family_id , column )
281
+ return copy .deepcopy (cells )
282
+
233
283
234
284
class InvalidReadRowsResponse (RuntimeError ):
235
285
"""Exception raised to to invalid response data from back-end."""
0 commit comments