How to load data using key_name by the Google App Engine downloader

I can load data, but key_name is empty. How can I use id in CSV as the key_name in the data store?

I like to use "id" as key_name because other data uses "id" as a foreign key. I am new to Google App Engine.

This is CSV data.

"id","name"
"1","USA"
"2","France"
"3","Italy"

This is yaml

- model: model.testcountry.TestCountry
  connector: csv
  connector_options:
    encoding: utf-8
    columns: from_header
  property_map:
    - property: __key__
      external_name: id
    - property: name
      external_name: name

PS: I'm trying to upload data to a local environment.


Update

Thanks for the help, I tried the code, but it does not work. The result is strange.

In the terminal window, a log message tells me that the download completed successfully, however I can not find any entries in the Google App Engine console (http: // localhost: 8080 / _ah / admin / datastore). The data store is empty, there is no record.

-

appcfg.py upload_data --config_file=bulkloader.yaml --filename=testcountries.csv --kind=TestCountry --url=http://localhost:8080/remote_api --num_thread=1 

Uploading data records.
[INFO    ] Logging to bulkloader/log.log
[INFO    ] Throttling transfers:
[INFO    ] Bandwidth: 250000 bytes/second
[INFO    ] HTTP connections: 8/second
[INFO    ] Entities inserted/fetched/modified: 20/second
[INFO    ] Batch Size: 10
Please enter login credentials for localhost:8080
Email: xxxxxxx
Password for l: 
[INFO    ] Opening database: bulkloader-progress-20110609.003032.sql3
[INFO    ] Connecting to localhost:8080/remote_api
[INFO    ] Starting import; maximum 10 entities per post
..........
[INFO    ] 100 entities total, 0 previously transferred
[INFO    ] 100 entities (3362 bytes) transferred in 1.9 seconds
[INFO    ] All entities successfully transferred

, . , Google App Engine ....

import_transform: int

PS: Mac OS X Snow Leopard Google App Engine.

+3
1

:

- import: google.appengine.ext.bulkload.transform
- model: model.testcountry.TestCountry
  connector: csv
  connector_options:
    encoding: utf-8
    columns: from_header
    property_map:
    - property: __key__
      external_name: id
      import_transform: transform.create_foreign_key('TestCountry')
    - property: name
      external_name: name
+1

All Articles