Received: by 10.224.207.66 with SMTP id fx2mr228544qab.7.1351821618558;
Thu, 01 Nov 2012 19:00:18 -0700 (PDT)
X-BeenThere: google-appengine@googlegroups.com
Received: by 10.229.175.20 with SMTP id v20ls5120465qcz.5.gmail; Thu, 01 Nov
2012 18:59:44 -0700 (PDT)
Received: by 10.224.180.141 with SMTP id bu13mr232279qab.2.1351821584339;
Thu, 01 Nov 2012 18:59:44 -0700 (PDT)
Received: by 10.224.67.196 with SMTP id s4msqai;
Thu, 1 Nov 2012 10:40:16 -0700 (PDT)
Received: by 10.52.76.136 with SMTP id k8mr5787313vdw.13.1351791615936;
Thu, 01 Nov 2012 10:40:15 -0700 (PDT)
Date: Thu, 1 Nov 2012 10:40:15 -0700 (PDT)
From: jay_m <yov...@gmail.com>
To: google-appengine@googlegroups.com
Message-Id: <89742edf-9354-4e8e-ae55-3bbae0e0d296@googlegroups.com>
Subject: ListProperty equals to <null> and makes entity unreadable
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_1761_21419633.1351791615575"
------=_Part_1761_21419633.1351791615575
Content-Type: multipart/alternative;
boundary="----=_Part_1762_27840733.1351791615576"
------=_Part_1762_27840733.1351791615576
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
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
------=_Part_1762_27840733.1351791615576
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
A few days ago I ran some data migration process that resulted in a few num=
ber pf oddities that I am trying to fix with. Here's my situation - I hope =
one of you out there could help. <div><br></div><div>Background:</div>=
<div>My app had a User model with two StringPropertyList properties re=
presenting a 1:many relationship between a user and an Item model. The prop=
erties, completed_items & in_progress_items, held the key_name of an It=
em model. Every time and Item model was created, I also added its key_name =
to the User who created it.</div><div><div><br></div><div>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 UserCompl=
etedItem / UserInProgressItem. After creating all new entities, I set the&n=
bsp; completed_items & in_progress_items properties to empty =
lists (User.completed_items=3D[] & User.in_progress_items mod=
el=3D[]) to reduce the size of each User entity. </div><div><br></div>=
<div>In addition to that, I removed from the code any reference to Use=
r.completed_items or User.in_progress_items and all data access a=
ctivities are performed using the two new models. </div></div><div><br=
></div><div>The problem:</div><div>When I look at the User entities using&n=
bsp;GAE's Admin's Data Viewer, the value of the two properties that I set t=
o [] appear as <missing> (an indication that the process of setting a=
n empty list actually worked). However, for a small number of entities,&nbs=
p;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 followin=
g exception gets thrown and the fetch fails:</div><div><h1 class=3D"ha" sty=
le=3D"font-family: arial, sans-serif; margin-top: 12px; margin-right: 1px; =
margin-bottom: 9px; padding-left: 8px; background: inherit; border-right: i=
nherit; line-height: normal; "><span id=3D":s" class=3D"hP" style=3D"paddin=
g-right: 10px; "><font size=3D"2"><b>Error_type<wbr>:<class 'google.ap<w=
br>pengine.ap<wbr>i.datastor<wbr>e_errors.B<wbr>adValueErr<wbr>or'> ; Er=
ror_mess<wbr>age: Property in_progress_item is required</b></font></sp=
an></h1></div><div>My question, how can I fetch these entities with &l=
t;null>? Is there a way to change the <null> values to []? <b=
r></div><div><br></div><div>Alternatively, can I remove the two properties =
from the Model class (since I am not going to reference them in the code an=
ymore) and things will work normally?</div><div><br></div><div>Thanks,</div=
><div>-jay</div><div><span class=3D"hP" style=3D"padding-right: 10px; "><di=
v></div></span></div>
------=_Part_1762_27840733.1351791615576--
------=_Part_1761_21419633.1351791615575--