Thanks Tim!

First off I should have named the subject of this post 'duplicate
entities'. Your response that it is definitely a problem with my code
was what I wanted to hear. I just needed to know this wasn't some
intended thing. I figured out what the problem was and I will post it
here for any novice  - like myself  - who might run into something
similar.

First my code that was posting entities to the datastore was the
default URL served in my app.yaml. I did this for testing purposes but
the effect was that when I refreshed my browser I posted the 30
entities  as intended (1st set of 30). Then when I went to the
datastore viewer in the SDK console and hit refresh I posted 30 more
entities - because apparently it reloads/refreshes the app( 2nd set of
30 entities) and then when I clicked 'list entities' in the datastore
viewer I was posting 30 more entities so now I had 90 entities when I
really only wanted the original 30.

The solution is, of course to set a unique key_name.

for thing in someList:
       newModel = abc(key_name=thing)

That way I only create the original 30 entities and any subsequent
reloads just overwrite the original 30 (which is what was intended)

On Feb 25, 6:26 pm, Tim Hoffman <[email protected]> wrote:
> Hi
>
> You will probably need to include some more code.  There is a bug in your
> code definately ;-)
>
> put saves an entity, if it's one you have just created abc = MyAbc()  then a
> put will create a new one.
> If you fetch the entity then put it, you won't create a new one.
>
> It sounds like your creating a new one through each pass of the loop rather
> than fetching and modifying.  But can't tell from what you have posted here.
>
> Rgds
>
> T

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to