2011-02-18 39 views
2

在默认bulkloader.yaml它曾这样说:gae bulkloader将不会解析导入时的密钥名称?

# - Check that __key__ property is what you want. Its value will become 
#  the key name on import, and on export the value will be the Key 
#  object. If you would like automatic key generation on import and 
#  omitting the key on export, you can remove the entire __key__ 
#  property from the property map. 

所以我假设默认的实现:

- property: __key__ 
     external_name: key 
     export_transform: transform.key_id_or_name_as_string 

应该在我的CSV文件导入键列到没有问题的数据存储。但它似乎什么都不做。 (其他列虽然解析得很好)

回答

1

我是对的,默认的工具就够了。不需要import_transform。我无法分析键值,因为无论包含哪个字段,csv文件中的第一列(包含键)都不能被解析。只需在第一列中设置一个虚拟列来解决问题。

@Calvin,对不起,我没有尽快验证你的答案。

2

您需要import_transform才能将密钥获取到数据存储中。导出转换是写出到csv文件。

我不认为有一个内置的转换方法将字符串转换回密钥。

我写了两个辅助函数来处理导出和导入密钥: key_to_reverse_str (export) and reverse_str_to_key (import) 当时的想法是保持价值人类可读的出口,但需要保持进口的所有数据。它们可能对你有用。