googledatastore 和 google.cloud.datastore 有什么区别?

What's the difference between googledatastore and google.cloud.datastore?

我想 get/put 在 GCE 上进行数据存储。 但是,有两个数据存储客户端库;googledatastore 和 google.cloud.datastore。

googledatastore 和 google.cloud.datastore 有什么区别?

很高兴您发现了这两个与 Datastore 交互的惯用客户端库的存在,所以让我写下它们之间的主要区别:

  • googledatastore is a low-level client library for Google Cloud Datastore written in both Java and Python. The clients embedded in this library are deliberately low-level and are mapped to lower RPC models used by Datastore. That way, it provides more flexibility (for instance for the creation of custom higher-level libraries), but it is also more complex to understand and use. Here you have the link for the library in GitHub, as well as some examples on how to use it. It only supports Python 2 and 2.7 and regarding its maintenance, as of writing the last release is 7.0.1 2017 年 4 月 10 日,因此大部分内容应该是最新的。
  • google.cloud is currently the official set of Python client libraries to work with the Google Cloud Platform. Talking about the Cloud Datastore Python client library specifically, you can access it in this GitHub repository. It is a high level library that is suitable for most users, and you can find some examples in the documentation for the GCP and the detailed documentation in this other page. It supports Python versions 2, 2.7, 3, 3.4, 3.5 and 3.6, and its latest release (v 1.5.0) 日期为 2018 年 2 月 14 日。

所以一般来说,我会说您可以在大多数用例中使用 google.cloud.datastore。它具有更多文档和示例,涵盖了您可能考虑使用的大部分功能。否则,如果您想从 lower-level 的角度管理一切,您可以完成 googledatastore.

的更大学习过程