Giter VIP home page Giter VIP logo

firebase-export-firestore-to-bigquery-samples's Introduction

Export Firebase Authentication users and Cloud Firestore Collections to BigQuery

  • Export Firebase Authentication users to Cloud Firestore Collection
  • Export All Cloud Firestore Collections and Specified collections to Cloud Storage
  • Export Specified Cloud Firestore Collections to BigQuery(Partitioned tables)

See

Inspired

Setup

Cloud SDK

See: Cloud SDK quickstarts

firebase

See: Firebase CLI

firebase login
firebase use <projectId>

See: Schedule data exports

You must complete the following tasks.

BigQuery

See: Creating datasets

Create new dataset. Dataset ID is firestore in this sample code.

node_modules

npm i
cd appengine
npm i
cd ../functions/
npm i

Deploy

appengine

cd appengine/
npm run deploy

functions

cd functions/
npm run deploy

Creating and Configuring Cron Jobs by Cloud Scheduler

See: Creating and Configuring Cron Jobs

Export Firebase Authentication users to Cloud Firestore Collection

Choose the Pub/Sub target and set topic.

Topic is cron-export-user-list-job in this sample code.

Payload string must be not null. But Any string is OK. Because Payload string doesn't be used in this sample code.

You can create the Firebase Authentication User using the Firebase Console if you don't have any the Firebase Authentication User yet.

You should create the Cloud Firestore Database using the Firebase Console if you don't have created the Cloud Firestore Database yet.

If you create the Cloud Firestore Database then you should select a Locked mode for your Cloud Firestore Security Rules.

Run Cloud Scheduler Job then check Cloud Firestore Collection named users using the Firebase Console.

Export All Cloud Firestore Collections and Specified collections to Cloud Storage

Choose the App Engine HTTP target and set URL and Choose Get method.

Ex.

  • /cloud-firestore-export?outputUriPrefix=gs://PROJECT-ID_backups-firestore&collections=users
  • /cloud-firestore-export?outputUriPrefix=gs://PROJECT-ID_backups-firestore&collections=users,etc

Run Cloud Scheduler Job then check Cloud Run Cloud Scheduler Job then check Cloud Storage bucket using the GCP Console.

Export Specified Cloud Firestore Collections to BigQuery(Partitioned tables)

Choose the App Engine HTTP target and set URL and Choose Get method.

Ex.

  • /cloud-firestore-export-to-bigquery?outputUriPrefix=gs://PROJECT-ID_backups-firestore&collections=users

  • /cloud-firestore-export-to-bigquery?outputUriPrefix=gs://PROJECT-ID_backups-firestore&collections=users,etc

Run Cloud Scheduler Job then check Cloud Run Cloud Scheduler Job then check BigQuery dataset using the GCP Console.

Additional

You can create the table to use Scheduling queries.

You can create the interactive dashboards to use Data Portal.

Coution

If collection fields is changed then set the projectionFields property or update BigQuery table schema

And edit Scheduling queries, do manual run if you need.

firebase-export-firestore-to-bigquery-samples's People

Contributors

zkohi avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.