Skip to content

Files

Latest commit

06f7b49 · Jan 31, 2025

History

History

bigquery-import

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jan 31, 2025
May 9, 2023
Jul 7, 2023

Import Data to Big Query

This template shows how to copy data from the Realtime Database (such as logs being written there) to Google Cloud's BigQuery.

Function Code

See file functions/index.js for the code.

The dependencies are listed in functions/package.json.

Sample Database Structure

As an example we'll be using a simple logs database structure:

/functions-project-12345
    /logs
        /key-123456
            text: "User signed in."
        /key-123457
            text: "Error: Could not connect to Database"

Setting up the sample

Set the bigquery.datasetName and bigquery.tableName Google Cloud environment variables to match the Dataset name and the Table name where you want the logs written to. For this use:

firebase functions:config:set bigquery.datasetName="bar" bigquery.tableName="baz"