Created
January 7, 2018 21:44
-
-
Save hiranya911/8751cdbb20ad75fa5a5b5f7e5c5ed9f3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import firebase_admin | |
from firebase_admin import credentials | |
from firebase_admin import db | |
from firebase_admin import firestore | |
# Helper functions removed for brevity. | |
# Full implementation at: https://gist.github.com/hiranya911/7cb8408bc24cfda39473b09244bc906c | |
if __name__ == '__main__': | |
cred = credentials.Certificate('path/to/service_account.json') | |
firebase_admin.initialize_app(cred, options={ | |
'databaseURL': 'https://my-project-id.firebaseio.com' | |
}) | |
# Extract | |
rooms = db.reference('rooms').get() | |
members = db.reference('members').get() | |
messages = db.reference('messages').get() | |
# Transform | |
rooms = transform_rooms(rooms, members) | |
messages = transform_messages(messages) | |
# Load | |
client = firestore.client() | |
load_rooms(client, rooms) | |
load_messages(client, messages) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment