https://github.com/keito5656/firebase-authentication-to-bigquery-export
An automatic tool for copying and converting Firebase Authentication data to BigQuery.
https://github.com/keito5656/firebase-authentication-to-bigquery-export
bigquery firebase-auth typescript
Last synced: 5 months ago
JSON representation
An automatic tool for copying and converting Firebase Authentication data to BigQuery.
- Host: GitHub
- URL: https://github.com/keito5656/firebase-authentication-to-bigquery-export
- Owner: keito5656
- License: mit
- Created: 2019-06-17T15:34:54.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-06-16T22:44:31.000Z (about 2 years ago)
- Last Synced: 2025-09-25T21:59:12.049Z (9 months ago)
- Topics: bigquery, firebase-auth, typescript
- Language: TypeScript
- Homepage:
- Size: 128 KB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Firebase Authentication to BigQuery export
An automatic tool for copying and converting Firebase Authentication data to BigQuery.
Inspired by [firestore-to-bigquery-export](https://github.com/Johannes-Berggren/firestore-to-bigquery-export)
- Create a BigQuery dataset with tables corresponding to your Firebase Authentication.
- This package doesn't write anything to Firebase Authentication.
## Installation
> npm i firebase-authentication-to-bigquery-export
```javascript
import bigExport from 'firebase-authentication-to-bigquery-export'
// or
const bigExport = require('firebase-authentication-to-bigquery-export')
// then
const GCPSA = require('./Your-Service-Account-File.json')
bigExport.setBigQueryConfig(GCPSA)
bigExport.setFirebaseConfig(GCPSA)
```
## How to
### API
```javascript
bigExport.setBigQueryConfig(
serviceAccountFile // JSON
)
```
```javascript
bigExport.setFirebaseConfig(
serviceAccountFile // JSON
)
```
```javascript
bigExport.createBigQueryTables()
```
```javascript
bigExport.copyToBigQuery(
verbose // Boolean
)
```
```javascript
bigExport.deleteBigQueryTables()
```
### Examples
```javascript
/*
Initialize BigQuery dataset named 'authentication' with four firebase authentication.
*/
bigExport.createBigQueryTables()
.then(res => {
console.log(res)
})
.catch(error => console.error(error))
```
Then, you can transport your data:
```javascript
/*
Copying and converting from Firebase Authentication data
*/
bigExport.copyToBigQuery()
.then(res => {
console.log('Copied ' + res + ' documents to BigQuery.')
})
.catch(error => console.error(error))
```
After that, you may want to refresh your data. For the time being, the quick and dirty way is to delete your tables and make new ones:
```javascript
// Deleting the given BigQuery tables.
bigExport.deleteBigQueryTables()
.then(res => {
console.log(res)
})
.catch(error => console.error(error))
```
Maybe you want to refresh / overwrite a single table?
```javascript
// Overwrites the users BigQuery table with fresh data from Firebase Authentication
bigExport.deleteBigQueryTables()
.then(() => {
bigExport.createBigQueryTables()
})
.then(promises => {
return bigExport.copyToBigQuery()
})
.then(res => {
console.log('Copied to BigQuery.')
})
.catch(error => console.error(error))
```
## Issues
Please use the [issue tracker](https://github.com/keito5656/firebase-authentication-to-bigquery-export/issues).