@@ -42,6 +42,43 @@ def __init__(self, row_key, table, filter_=None):
4242 self ._row_key = _to_bytes (row_key )
4343 self ._table = table
4444 self ._filter = filter_
45+ self ._rule_pb_list = []
46+
47+ def increment_cell_value (self , column_family_id , column , int_value ):
48+ """Increments a value in an existing cell.
49+
50+ Assumes the value in the cell is stored as a 64 bit integer
51+ serialized to bytes.
52+
53+ .. note::
54+
55+ This method adds a read-modify rule protobuf to the accumulated
56+ read-modify rules on this :class:`Row`, but does not make an API
57+ request. To actually send an API request (with the rules) to the
58+ Google Cloud Bigtable API, call :meth:`commit_modifications`.
59+
60+ :type column_family_id: str
61+ :param column_family_id: The column family that contains the column.
62+ Must be of the form
63+ ``[_a-zA-Z0-9][-_.a-zA-Z0-9]*``.
64+
65+ :type column: bytes
66+ :param column: The column within the column family where the cell
67+ is located.
68+
69+ :type int_value: int
70+ :param int_value: The value to increment the existing value in the cell
71+ by. If the targeted cell is unset, it will be treated
72+ as containing a zero. Otherwise, the targeted cell
73+ must contain an 8-byte value (interpreted as a 64-bit
74+ big-endian signed integer), or the entire request
75+ will fail.
76+ """
77+ column = _to_bytes (column )
78+ rule_pb = data_pb2 .ReadModifyWriteRule (family_name = column_family_id ,
79+ column_qualifier = column ,
80+ increment_amount = int_value )
81+ self ._rule_pb_list .append (rule_pb )
4582
4683
4784class RowFilter (object ):
0 commit comments