def _capture_game_snapshot(game, char): # game history is per game, so parent should be game and not the user # game history id history_id = GameHistory.allocate_ids(size=1, parent=game.key)[0] # game history key generated using history_id and game as its ancestor history_key = ndb.Key(GameHistory, history_id, parent=game.key) game_history = GameHistory(key=history_key, step_char=char, game_snapshot=game) # save game history game_history.put()