A few days ago I ran some data migration process that resulted in a few 
number pf oddities that I am trying to fix with. Here's my situation - I 
hope one of you out there could help. 

Background:
My app had a User model with two StringPropertyList properties representing 
a 1:many relationship between a user and an Item model. The properties, 
completed_items & in_progress_items, held the key_name of an Item model. 
Every time and Item model was created, I also added its key_name to the 
User who created it.

Since these lists grew to contain several hundred of items, I decided to 
migrate their data into two new models: UserCompletedItem & 
UserInProgressItem. Each model holds the item key_name and the user 
key_name. As part of the migration, I ran on all User entities, fetched the 
user's completed_items & in_progress_items lists and for each item I 
created a new UserCompletedItem / UserInProgressItem. After creating all 
new entities, I set the  completed_items & in_progress_items properties to 
empty lists (User.completed_items=[] & User.in_progress_items model=[]) to 
reduce the size of each User entity. 

In addition to that, I removed from the code any reference 
to User.completed_items or User.in_progress_items and all data access 
activities are performed using the two new models. 

The problem:
When I look at the User entities using GAE's Admin's Data Viewer, the value 
of the two properties that I set to [] appear as <missing> (an indication 
that the process of setting an empty list actually worked). However, for a 
small number of entities, the two properties equal to <null>. In addition 
to that, in my code, whenever I try to fetch an entity with a <null> value, 
the following exception gets thrown and the fetch fails:
*Error_type:<class 'google.appengine.api.datastore_errors.BadValueError'> ; 
Error_message: Property in_progress_item is required*
My question, how can I fetch these entities with <null>? Is there a way to 
change the <null> values to []? 

Alternatively, can I remove the two properties from the Model class (since 
I am not going to reference them in the code anymore) and things will work 
normally?

Thanks,
-jay

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/lXXCbmSNvjIJ.
To post to this group, send email to google-appengine@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.

Reply via email to