Thanks for the response.
I have already seen that expando answer in stackoverflow and I was having
trouble with one thing.
>From stackoverflow:
Before:
class Person(db.Model):
name = db.StringProperty()
age = db.StringProperty() #this will go to int
After
class Person(db.Expando):
pass
for person in Person.all():
person.age = int(person.age)
person.put()
Very after:
class Person(db.Model):
name = db.StringProperty()
age = db.IntegerProperty()
Do I have to write all this in models.py file? Including the for loop? I
put the similar code in models.py file and nothing happened. I want to use
expando but it doesn't work.
On Sunday, May 19, 2019 at 2:30:30 AM UTC+10, Vitaly Bogomolov wrote:
>
> Hi.
>
> The key thing is usage an Expando subclass. For example, as described here:
>
> Change IntegerProperty to FloatProperty of existing AppEngine DataStore
>
> https://stackoverflow.com/questions/4742875/change-integerproperty-to-floatproperty-of-existing-appengine-datastore
>
> Also, these links may be useful:
>
>
> https://medium.com/engineering-workzeit/migrating-versioned-entities-in-google-app-engine-e21938a2e2ec
>
> https://stackoverflow.com/questions/19842671/migrating-data-when-changing-an-ndb-fields-property-type
>
>
> WBR, Vitaly
>
> I have a django project and I want to change property type of one of the
>> models. My current model.py is:
>>
>> class Person(ndb.Model):
>> property_one= ndb.StringProperty()
>> property_two= ndb.StringProperty()
>>
>> and I want to change it to:
>>
>> class Person(ndb.Model):
>> property_one= ndb.TextProperty()
>> property_two= ndb.TextProperty()
>>
>> Both of my properties already have data and I cannot store more than 1500
>> bytes. So I want to convert from string to text without losing any data.
>> How can I achieve this?
>>
>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-appengine/f26f2110-b559-4f94-ae90-c3b81128da1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.