@ndb.transactional
def update_counter(name):
 counter = Counter.get_by_id(name)
 if (counter is None):
  counter = Counter(id=name, count=0)
 counter.count += 1
 counter.put()
 return counter.count

@ ndb . transactional def update_counter ( name ) : counter = Counter . get_by_id ( name ) if ( counter is None ) : counter = Counter ( id = name , count = 0 ) counter . count += 1 counter . put ( ) return counter . count
increment the named counter by 1 .