@@ -46,23 +46,18 @@ def __init__(self, row_key, table, filter_=None):
4646
4747 def append_cell_value (self , column_family_id , column , value ):
4848 """Appends a value to an existing cell.
49-
5049 .. note::
51-
5250 This method adds a read-modify rule protobuf to the accumulated
5351 read-modify rules on this :class:`Row`, but does not make an API
5452 request. To actually send an API request (with the rules) to the
5553 Google Cloud Bigtable API, call :meth:`commit_modifications`.
56-
5754 :type column_family_id: str
5855 :param column_family_id: The column family that contains the column.
5956 Must be of the form
6057 ``[_a-zA-Z0-9][-_.a-zA-Z0-9]*``.
61-
6258 :type column: bytes
6359 :param column: The column within the column family where the cell
6460 is located.
65-
6661 :type value: bytes
6762 :param value: The value to append to the existing value in the cell. If
6863 the targeted cell is unset, it will be treated as
@@ -75,6 +70,36 @@ def append_cell_value(self, column_family_id, column, value):
7570 append_value = value )
7671 self ._rule_pb_list .append (rule_pb )
7772
73+ def increment_cell_value (self , column_family_id , column , int_value ):
74+ """Increments a value in an existing cell.
75+ Assumes the value in the cell is stored as a 64 bit integer
76+ serialized to bytes.
77+ .. note::
78+ This method adds a read-modify rule protobuf to the accumulated
79+ read-modify rules on this :class:`Row`, but does not make an API
80+ request. To actually send an API request (with the rules) to the
81+ Google Cloud Bigtable API, call :meth:`commit_modifications`.
82+ :type column_family_id: str
83+ :param column_family_id: The column family that contains the column.
84+ Must be of the form
85+ ``[_a-zA-Z0-9][-_.a-zA-Z0-9]*``.
86+ :type column: bytes
87+ :param column: The column within the column family where the cell
88+ is located.
89+ :type int_value: int
90+ :param int_value: The value to increment the existing value in the cell
91+ by. If the targeted cell is unset, it will be treated
92+ as containing a zero. Otherwise, the targeted cell
93+ must contain an 8-byte value (interpreted as a 64-bit
94+ big-endian signed integer), or the entire request
95+ will fail.
96+ """
97+ column = _to_bytes (column )
98+ rule_pb = data_pb2 .ReadModifyWriteRule (family_name = column_family_id ,
99+ column_qualifier = column ,
100+ increment_amount = int_value )
101+ self ._rule_pb_list .append (rule_pb )
102+
78103
79104class RowFilter (object ):
80105 """Basic filter to apply to cells in a row.
0 commit comments