python - Is there something like DatastoreOutputWriter? -
how write mapreduce results datastore? first thought "datastoreoutputwriter", apparently there no such thing.
clarification: question not modifying/saving entities. instead, i'd process them, , store processed results (different kind of entities) in datastore.
example: count number of users every , then, , save results new entity containing date , count.
the purpose of inputreader split job tasks each entity. write handlers handle each task passed appropriate entity.
you don't need datastoreoutputwriter since can write entity in task. mapreduce lib has tools make bit more efficient using async puts. they're recommended code doesn't use them still work. here's simple handler makes small modification , writes entity in mapper phase:
def addnewattribute(entity, *args, **kwargs): try: if not entity.get("newattribute"): entity["newattribute"] = false yield op.db.put(entity) # save entity datastore yield op.counters.increment("touched") # use mapreduce counter track operations except: yield op.counters.increment("touchfail")
Comments
Post a Comment