Firebase

## Firebase Cloud Firestore
Google の柔軟でスケーラブルな NoSQL クラウド データベースを使用して、クライアント側開発とサーバー側開発のデータを保存、同期します。

**参考**

https://qiita.com/bathtimefish/items/164d2b0cd268f209db9bhttps://firebase.google.com/docs/firestore/quickstart#python_1

**ADD**

“`

import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore

cred = credentials.Certificate(“/Users/u26/fire/key/mknod-gps-3559226f38f2.json”)
firebase_admin.initialize_app(cred)

db = firestore.client()

# add
doc_ref = db.collection(u’users’).document(u’alovelace’)
doc_ref.set({
u’first’: u’Ada’,
u’last’: u’Lovelace’,
u’born’: 1815
})

# update
doc_ref.set({
u’first’: u’Ada’,
u’last’: u’Lovelace’,
u’born’: 1978
})
“`

**READ**

“`

import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore

cred = credentials.Certificate(“/Users/u26/fire/key/mknod-gps-3559226f38f2.json”)
firebase_admin.initialize_app(cred)

db = firestore.client()

# read
users_ref = db.collection(u’users’)
docs = users_ref.stream()

for doc in docs:
print(u'{} => {}’.format(doc.id, doc.to_dict()))
“`