简体   繁体   English

将 Collections 导出到 BigQuery

[英]Export Collections to BigQuery

I have tried to export collection to BigQuery using Export Collections to BigQuery extension.我尝试使用Export Collections to BigQuery BigQuery将集合导出到 BigQuery。
But I am not able to export all collections.但我无法导出所有 collections。

I need to export all collection and subcollection to BiqQuery using Export Collections to BigQuery extensions我需要使用Export Collections to BigQuery extensions 将所有集合和子集合导出到 BiqQuery

I am able to export only one collection but can't export all.我只能导出一个集合,但不能全部导出。

Could anyone please help me to export all collections and subcollections?谁能帮我导出所有 collections 和子集合?

You can try to export the information to a bucket or a local file by running the command gcloud firestore export gs://mybucket/my/path as mentioned here .您可以尝试通过运行命令的信息,水桶或本地文件导出gcloud firestore export gs://mybucket/my/path提到 这里 This will export all the collections with a single command.这将使用单个命令导出所有集合。

I recommend you to export it to GCS, however, you can load the info to BigQuery by following one of these methods .我建议您将其导出到 GCS,但是,您可以按照以下方法之一将信息加载到 BigQuery。

There most likely is an issue with the extension you are using since extensions are still on beta , but you can still open a Feature request so that they add more functionalities to the extension in the future and/or report anybug directly .您使用的扩展程序很可能存在问题,因为扩展程序仍处于测试阶段,但您仍然可以打开功能请求,以便他们将来为扩展程序添加更多功能和/或直接报告任何错误

Hope you find this useful!希望你觉得这个有用!

You can install a second extension "stream collections to biquery" to have a second collection exported to BQ.您可以安装第二个扩展“将集合流式传输到 biquery”以将第二个集合导出到 BQ。 Just go to the menu extensions and you did the first time只需转到菜单扩展程序,您就第一次这样做了

One thing that was helpful for me was to go to the Cloud Functions section for my Firebase project, hop over to the GCP console side of things, and download a zip of the source code deployed for my ext-firestore-bigquery-export-fsexportbigquery function. One thing that was helpful for me was to go to the Cloud Functions section for my Firebase project, hop over to the GCP console side of things, and download a zip of the source code deployed for my ext-firestore-bigquery-export-fsexportbigquery function。

In there, I noticed that the value of process.env.COLLECTION_PATH ultimately gets passed through to functions.firestore.document() which is just constructing a namespaced collection path, where wildcards can be used at any level in the path...and therein lies the magic.在那里,我注意到process.env.COLLECTION_PATH的值最终会传递给functions.firestore.document() ,它只是构建一个命名空间的集合路径,通配符可以在路径中的任何级别使用......并且这就是魔法。

If you set your Collection Path to simply be a wildcard variable, such as "{AnyCollection}", then the function will capture events for any and all collections in your Firestore DB.如果您将收集路径设置为简单的通配符变量,例如“{AnyCollection}”,那么 function 将捕获 Firestore DB 中所有 collections 的事件。 Only one instance of the extension is needed.只需要一个扩展实例。

Overall solution:整体解决方案:

  • Set Collection Path to "{AnyCollection}"集合路径设置为“{AnyCollection}”
  • Set Table ID to something indicating that it's multi collection, such as "AnyCollection"表 ID设置为表明它是多集合的东西,例如“AnyCollection”
  • It can be helpful to set Wildcard Column field with Parent Firestore Document IDs to true, although not required.带有父 Firestore 文档 ID 的通配符列字段设置为 true 会很有帮助,尽管不是必需的。
    • You also could interrogate the name of the collection out of the document_name column in your BigQuery table, which includes paths such as "projects/my-firebase-project/databases/(default)/documents/my-firestore-collection/U5OeEv7jZCY8ja0g2gLr".您还可以从 BigQuery 表中的document_name列中查询集合的名称,其中包括诸如“projects/my-firebase-project/databases/(default)/documents/my-firestore-collection/U5OeEv7jZCY8ja0g2gLr”之类的路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM