Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Import Data to BigQuery

Hi, 

Is it possible to download event data from Firebase and dump it back to BigQuery in the same format as it is for Daily Dump(A full export of data, which takes place once a day)?

Thanks

1 1 118
1 REPLY 1

Yes, it's possible to replicate the Firebase daily dump format within BigQuery using a few strategic steps.

Firebase offers two primary methods for exporting event data to BigQuery: Daily Exports and Streaming Exports. Daily Exports automatically create tables in BigQuery containing a day's worth of raw event data with a predefined schema. Streaming Exports provide real-time event data in an intraday table with a schema similar to daily exports but optimized for streaming updates.

To mirror the daily dump format while maintaining control over the process, you can follow these steps:

First, analyze the structure of your Firebase daily export tables in BigQuery, noting the column names and data types. Then, create a new table in BigQuery that matches this schema exactly.

Use BigQuery SQL to query the intraday table, transforming and aggregating the data into the desired daily format. Insert the results into the newly created target table. For automation, schedule these query and load operations using BigQuery's scheduling features.

Here is an example SQL query to illustrate this process:

INSERT INTO my_dataset.daily_dump_replica
SELECT 
  event_date,  
  event_timestamp, 
  event_name,
  user_id, 
  platform,
  -- ... other columns as needed
FROM my_dataset.firebase_intraday
WHERE _TABLE_SUFFIX = FORMAT_DATE('%Y%m%d', CURRENT_DATE()) -- Filter for today's data
GROUP BY event_date, event_timestamp, event_name, user_id, platform
-- ... other aggregations or transformations as needed

If dealing with large volumes of data, leverage BigQuery's partitioning and clustering features on your target table for improved performance. Also, establish a data retention policy for both the intraday table and the replicated daily dump table.

For very specific data extraction requirements, consider using Firebase's Analytics Data API, which offers more granular control but requires more development effort. To visualize the data similarly to the Firebase console, connect your BigQuery tables to Google Data Studio for flexible reporting and dashboarding.