Migrating data when changing an NDB field's property type

前端 未结 2 1836
野性不改
野性不改 2020-11-29 07:53

Suppose I initially create an ndb.Model and wanted to change a field\'s ndb property type (e.g. IntegerProperty to StringProperty), but wanted to cast the current data store

2条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-29 08:32

    Just adding to Tim's answer, if you want to change your property to Text, you can:

    from google.appengine.api import datastore_types
    
    (...)
    
    for i in results:
        i['production_year'] = datastore_types.Text(i['production_year'])
    

提交回复
热议问题