简体   繁体   English

将数据从 Firestore 导入 bigQuery

[英]importing data from firestore into bigQuery

I have upgraded my account to blaze which is one of the prerequisite.我已将我的帐户升级为 blaze,这是先决条件之一。 I have tried to followed the FAQ Link BigQuery to Firebase.我试图按照常见问题链接 BigQuery 到 Firebase。 still not able to see any of the data from firestore or firebase-realtimeDatabase into bigQuery.仍然无法在 bigQuery 中看到来自 firestore 或 firebase-realtimeDatabase 的任何数据。

I see option in bigQuery to create Dataset.我在 bigQuery 中看到创建数据集的选项。 however after creating dataset it allows me to upload data from [file], [cloud storage], [bigQuery],[google Drive] .但是在创建数据集后,它允许我从 [file], [cloud storage], [bigQuery],[google Drive] 上传数据。 but not firestore database.但不是 Firestore 数据库。

Plesae help.请帮忙。

Firestore now allows to import / export data. Firestore 现在允许导入/导出数据。 The data is exported to a Cloud Storage bucket and from there it can be imported into Big Query.数据会导出到 Cloud Storage 存储分区,然后可以从那里导入 Big Query。 Here are some links that might be helpful:以下是一些可能有用的链接:

** Edit: Docs for BigQuery imports from Firestore are now available https://cloud.google.com/bigquery/docs/loading-data-cloud-firestore ** 编辑:现在可以从 Firestore 导入 BigQuery 的文档https://cloud.google.com/bigquery/docs/loading-data-cloud-firestore

Guys there is an example for importing data into bigquery 伙计们,有一个将数据导入bigquery的示例

https://github.com/firebase/functions-samples/tree/master/bigquery-import https://github.com/firebase/functions-samples/tree/master/bigquery-import

luck.. 运气..

In case anyone need it.万一有人需要它。 I ended up automating scripts because current export data option only allows stream data and preserve for 30 days.我最终自动化了脚本,因为当前的导出数据选项只允许流数据并保留 30 天。

export data导出数据

gcloud beta firestore export --collection-ids=users gs://mybucket/users

load backup into bq将备份加载到 bq

bq load --source_format=DATASTORE_BACKUP mydataset.users gs://gs://mybucket/users/all_namespaces/kind_users/all_namespaces_kind_users.export_metadata

You can now export data from Cloud Firestore to BigQuery with a Firebase Extension.您现在可以使用 Firebase 扩展程序将数据从 Cloud Firestore 导出到 BigQuery。 See: https://firebase.google.com/products/extensions/firestore-bigquery-export请参阅: https : //firebase.google.com/products/extensions/firestore-bigquery-export

Also see David's answer on how to import/export data.另请参阅 David 关于如何导入/导出数据的回答

Outdated answer below:下面过时的答案:

There is no built-in support to import data from the Firebase Realtime Database or Cloud Firestore into BigQuery. 没有内置支持将数据从 Firebase 实时数据库或 Cloud Firestore 导入 BigQuery。

\n

For now, if you want to import data, you'll have to write code to do so. 目前,如果您想导入数据,则必须编写代码来执行此操作。

I made an NPM package that lets you create a BigQuery dataset and tables with autogenerated schemas based on your Firestore data, and then copy and convert chosen Firestore collections.我制作了一个 NPM 包,可让您根据 Firestore 数据使用自动生成的架构创建 BigQuery 数据集和表,然后复制和转换所选的 Firestore 集合。

https://www.npmjs.com/package/firestore-to-bigquery-export https://www.npmjs.com/package/firestore-to-bigquery-export

You should use the BigQuery export extension built-in in Firebase您应该使用 Firebase 内置的 BigQuery 导出扩展

在此处输入图片说明

See details: https://firebase.google.com/products/extensions/firestore-bigquery-export查看详情: https : //firebase.google.com/products/extensions/firestore-bigquery-export

Now, this extension will be importing to your BigQuery table new created/updated/deleted documents inside a collection, your current old data before the new one is added will not be placed inside this table.现在,此扩展程序将导入到您的 BigQuery 表中,新创建/更新/删除的文档在集合中,在添加新数据之前,您当前的旧数据不会放置在此表中。

To import all the previous data you will need first to install the extension because all the writes while doing the export first without installing the extension will be lost.要导入所有以前的数据,您首先需要安装扩展程序,因为在不安装扩展程序的情况下首先进行导出时的所有写入都将丢失。

After you install the extension, just use gcloud to export all the current dataset安装扩展后,只需使用 gcloud 导出所有当前数据集

https://github.com/firebase/extensions/blob/master/firestore-bigquery-export/guides/IMPORT_EXISTING_DOCUMENTS.md https://github.com/firebase/extensions/blob/master/firestore-bigquery-export/guides/IMPORT_EXISTING_DOCUMENTS.md

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

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