Hi, thanks both. I am using Java api and i try the questions and i get the results that you said to me.
I am really affraid to make a model with the present requirements, and that the client in six months want to make really big changes. On 6 sep, 13:58, Tim Hoffman <zutes...@gmail.com> wrote: > Hi > > You might like to say if you are using python or java, that way > examples can be relevent to your choice. > > > > > DOUBT 1: What happens, if i make a change to the User class and, for > > example, i add to the class the property sex (String). Then i deploy > > my app again in the appengine. > > > Now i create a new user with this values username = "mcculloch", > > password = "mc123" and sex = "M" and persist the user. > > > I think that if i make the query to get all the useri will get the 2 > > users, and the property sex to the user "ian" will be null. Is that > > correct? > > Yes. > > > > > DOUBT 2: Now i realize that i don't want to store the sex of the user, > > and also i think that i don't want the id property as an integer. Now > > i want that the username will be the key of the class, so i remove the > > id property and add the annotation to make the username property the > > Primary Key of the entity. > > > Then i deploy the app on appengine, create a new user with this > > values: username = "eric", password = "eric123". > > > What does happen now i query all the users, will i get the two users? > > Ok a bunch of stuff going on here. > > You refer to the primary key, do you mean as per SQL or some aspect of > a java api. > In the underlying datastore terms the key of entity once created is > fixed. > > You would have to copy the original entity and delete the old one to > change the key. > > As to the sex property. (I will start using python behaviour) you can > drop the sex property definition from the > entity but the value assigned to the Sex property will still exist in > entities that had the value set. > > If you change the type of a property then you will need to fetch the > old entity and update the value of the property to the type the model > expects. This may require you to manipulate the underlying raw > datastore entity or create a transition class to help you migrate the > schema (i prefer the former). > if not you will get errors when you retrieve entities with a mis- > matched entity definition. > > If you fetch all uses User.all().fetch(n) you will get all users added > assuming you have fixed above. > > > DOUBT 3: Let's say that i realize that i really need the sex property > > for the users, so i add again the sex property to the User class and > > deploy again to the datastore. > > > If i query for all the users? What datastore will return to me? All > > the users? Only those that the sex is not null? > > All users will be returned, and some will still have a value for sex. > You can't do a not null query unless you have actually stored None > (python) in a property. (More specifically you can't query for > entities that have not had a property value set). > > > > > DOUBT 4: Finally, what happens if i want to have 2 enviroments of my > > app? I have to create 2 apps on appengine? If this is the way, let's > > supose that in my production enviroment i have a lot of data and i > > want to make a copy of that data to my testing app so i can make > > testing with good data. Can i copy that data from one app to another? > > How could i? > > Seehttp://code.google.com/appengine/docs/python/tools/uploadingdata.html > > 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 google-appeng...@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.