@@ -75,6 +75,36 @@ def append_cell_value(self, column_family_id, column, value):
7575 append_value = value )
7676 self ._rule_pb_list .append (rule_pb )
7777
78+ def increment_cell_value (self , column_family_id , column , int_value ):
79+ """Increments a value in an existing cell.
80+ Assumes the value in the cell is stored as a 64 bit integer
81+ serialized to bytes.
82+ .. note::
83+ This method adds a read-modify rule protobuf to the accumulated
84+ read-modify rules on this :class:`Row`, but does not make an API
85+ request. To actually send an API request (with the rules) to the
86+ Google Cloud Bigtable API, call :meth:`commit_modifications`.
87+ :type column_family_id: str
88+ :param column_family_id: The column family that contains the column.
89+ Must be of the form
90+ ``[_a-zA-Z0-9][-_.a-zA-Z0-9]*``.
91+ :type column: bytes
92+ :param column: The column within the column family where the cell
93+ is located.
94+ :type int_value: int
95+ :param int_value: The value to increment the existing value in the cell
96+ by. If the targeted cell is unset, it will be treated
97+ as containing a zero. Otherwise, the targeted cell
98+ must contain an 8-byte value (interpreted as a 64-bit
99+ big-endian signed integer), or the entire request
100+ will fail.
101+ """
102+ column = _to_bytes (column )
103+ rule_pb = data_pb2 .ReadModifyWriteRule (family_name = column_family_id ,
104+ column_qualifier = column ,
105+ increment_amount = int_value )
106+ self ._rule_pb_list .append (rule_pb )
107+
78108
79109class RowFilter (object ):
80110 """Basic filter to apply to cells in a row.
0 commit comments