从 Google 云存储读取并加载到 Google 数据存储

Read from Google Cloud Storage and Load to Google Data Store

我是 Google Cloud 的新手,正在探索 DataStore。我不是程序员,但希望成为一名程序员。

谁能帮我满足下面的要求?

我有一个 JSON 文件,其中包含大约 5000 条记录,我想将数据加载到 Google DataStore。如果有人能逐步解释过程,我会很乐意实施。

感谢任何帮助。

如果您想使用 JSON 导入 Datastore,则需要使用 Dataflow

Cloud Storage Text to Datastore template you can read from text files stored in Cloud Storage and write JSON encoded Entities to Datastore. Each line in the input file should be in JSON format specified here

如果你以前导出过一些东西,你想把它导出回来,你可以按照这个(不是JSON)

如果您想将数据从 Google Cloud Storage Bucket 导入到 Google Datastore,您需要:

我看到您提到您的云存储桶中已经有一个文件。如果不是这样,你可以随时参考这个quickstart on how to create a Cloud Storage Bucket

It is very important to create or have already your Cloud Storage bucket in the same location as your Cloud Datastore.

要继续,请确保为您的用户帐户分配 IAM 角色以授予下一个权限:

  • datastore.databases.import。例如,Datastore Import Export Admin 角色授予这两种权限。

  • 你也可以给要导入Editor角色的用户,但是我强烈建议你从一开始就划分权限,因为你会习惯不给为您的用户提供额外权限。

如果您不确定如何 add/grant 或撤销不同的角色,您可以查看本指南,了解如何 Granting, changing, and revoking access to resources works

最后,关于导入以及导入方式,您有不同的选择。您可以按照此 documentation 使用控制台、gcloud 或 rest。

如果您想继续使用 Datastore,我强烈建议您查看它的 best practices