Den*_*nis 6 protocol-buffers firebase google-cloud-platform protoc google-cloud-firestore
我想我真的很接近或者我不明白我在做什么......
我们在项目中使用 Firestore,我正在编写一个自定义脚本来导出所有数据。但可以选择通过 gcloud CLI 导出它。这很棒,但是返回的数据位于协议缓冲区和二进制文件中。
我通过 gcloud CLI 导出数据,如下所示
gcloud beta firestore export gs://[BUCKET_NAME]
它采用您的默认项目并导出您提供的存储桶名称中的数据。桶内的结果是这样的:
- timestamp folder
  - timestamp.overall_export_metadata file
  - all_namespaces folder
    - all_kinds folder
      - all_namespaces_all_kinds.export_metadata file
      - output-0 file
      - output-1 file
      - ... > up until output-250 file
我下载了https://github.com/googleapis/googleapis proto 文件并尝试使用以下命令解码输出
protoc --decode google.firestore.v1beta1.Document ./google/firestore/v1beta1/document.proto < output-0 (or any other number for that matter)
resulted in: 
Failed to parse input.
有效的命令如下:
protoc --decode google.firestore.admin.v1beta1.ExportDocumentsMetadata ./google/firestore/admin/v1beta1/firestore_admin.proto < all_namespaces_all_kinds.export_metadata
resulted in:
start_time {
  nanos: 629329010
  1: "export_entities"
  3: 1565426104489599
}
end_time {
  1: "__all__"
  2: "output-0"
  2: "output-1"
  2: "output-2"
  ... etc, 2 stays the key, output-{number} changes until
  3 {
    1: "__all__"
  }
}
和
protoc --decode_raw < all_namespaces_all_kinds.export_metadata
resulted in
1 {
  1: "export_entities"
  2: 1565426014407794
  3: 1565426104489599
}
2 {
  1: "__all__"
  2: "output-0"
  ... same as before until the 
  3 {
    1: "__all__"
  }
}
我缺少一块拼图,因为我感觉我必须将所有输出与元数据结合起来才能对其进行解码。但我不知道如何..
| 归档时间: | 
 | 
| 查看次数: | 1007 次 | 
| 最近记录: |