title: Google Cloud BigTable : Update the column value
body: <p>I have the following BigTable structure for an example:</p>
  
  <pre><code>Table1 : column_family_1 : column_1 : value
  </code></pre>
  
  <p>The <code>value</code> here is a number let's say. This is managed by a dataflow and I want to update the value every time.</p>
  
  <p>This value might be an amount and I want to update it every time user makes a purchase (to maintain total spent till date), so I am doing the following in purchase event listener dataflow (whenever a purchase event is encountered):</p>
  
  <ul>
  <li>Make a BigTable request to get the value by id</li>
  <li>Add the amount spent in new purchase to the one present in BigTable search response</li>
  <li>Make a <code>Put</code> request to update the value</li>
  </ul>
  
  <p>Although this approach has some network latency, it seems to work. The scenario where this fails is, when there are multiple workers of a dataflow, user makes more than one purchase and the events go to multiple workers, e.g.:</p>
  
  <ul>
  <li>Worker 1 gets event 1, fetches the amount and adds the spent amount into it</li>
  <li>Worker 2 gets event 2, fetches the <strong>old</strong> amount and adds the spent amount into it</li>
  <li>Both workers make <code>Put</code> requests and they get overwritten</li>
  </ul>
  
  <p>To prevent this, I am trying to make a request which just says in plain text, <code>add 10 to the spent amount value</code>. Is this something we can do in dataflow?</p>