开发者

Updating datastore entities with appcfg.py renames primary key

开发者 https://www.devze.com 2023-02-13 07:56 出处:网络
I am using appcfg.py to update the entities in my datastore.I upload a csv: Name,Type Jim,2 Bob,4 I then look in the datastore and note that the primary key field for these entities are of the form

I am using appcfg.py to update the entities in my datastore. I upload a csv:

Name,Type
Jim,2
Bob,4

I then look in the datastore and note that the primary key field for these entities are of the form "id=#". I then download this datastore type using appcfg.py, it comes down as:

Name,Type,id
Jim,2,10001
Bob,4,10002

I modify the Type field and upload it again. The result is a duplicate set of entries where now the primary key is of the form "name=#". Looking through my config.yaml, this is the relevant entry for the key:

 property_map:
    - property: __key__
      external_name: id
      export_transform: transform.key_id_or_name_as_string

I simply want to update the existing datastore entities, how do I 开发者_如何学Pythonmake this happen?


try:

- property: __key__ 
  external_name: key 
  export_transform: transform.key_id_or_name_as_string 
  import_transform: transform.create_foreign_key('YourKind', key_is_id=True) 

http://groups.google.com/group/google-appengine/browse_thread/thread/3f211d42cf544c1a/4659a30b9380ab8a?lnk=gst&q=key_id_or_name_as_string#4659a30b9380ab8a

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号