Setup
This project was created and tested using Node v9.1.0.
Setup using: npm install
This project takes a self-serve backup generated from the Firebase Realtime Database and outputs a flattened CSV as output.
The CSV is made to be uploaded to BigQuery but can be used for any number of purposes.
The term flattened is used to represent the following transformation
{
"a": true,
"b": {
"c": true
}
}
will be converted to
a,true
b,c,true
This project was created and tested using Node v9.1.0.
Setup using: npm install
To generate a self-serve backup:
https://console.firebase.google.com/project/<YOUR_PROJECT>/database/backups).Run this using: node export.js --inputURL http://link/to/backup.gz --outputPath /tmp/output.gz
--inputURL http://path/to/input OR --inputPath /path/to/inputrequired
This flag indicates where the input resides.
--outputPath /path/to/outputrequired
This flag indicates where the output csv should reside.
--noCompressedInputoptional
This flag takes no parameters. By default, it is expected that the input is gzipped. If it is not, use this flag to indicate as such.
--noCompressedOutputoptional
This flag takes no parameters. By default, it is expected that the output will be gzipped. If it should not, use this flag to indicate as such.
--fillWithNullsoptional
This flag takes no parameters. By default, the output will contain rows of mixed-width depending on how deep the input data is. By using this flag, the output will be normalized to contain 32 columns.
Create from sourceGoogle Cloud Storage, set the path (e.g. gs://my-bucket/output.gz)CSVyour-dataset.your-table--fillWithNulls, you can set Automatically detect), otherwise click Edit as Text and input:
c1:STRING,c2:STRING,c3:STRING,c4:STRING,c5:STRING,c6:STRING,c7:STRING,c8:STRING,c9:STRING,c10:STRING,c11:STRING,c12:STRING,c13:STRING,c14:STRING,c15:STRING,c16:STRING,c17:STRING,c18:STRING,c19:STRING,c20:STRING,c21:STRING,c22:STRING,c23:STRING,c24:STRING,c25:STRING,c26:STRING,c27:STRING,c28:STRING,c29:STRING,c30:STRING,c31:STRING,c32:STRINGCommaCheck (ONLY if you didn't use --fillWithNulls)Create Table.This is not an official Google product