Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/slevin48/firestore
Firestore called from Streamlit apps
https://github.com/slevin48/firestore
database firestore gcp streamlit
Last synced: about 1 month ago
JSON representation
Firestore called from Streamlit apps
- Host: GitHub
- URL: https://github.com/slevin48/firestore
- Owner: slevin48
- Created: 2021-01-30T21:23:42.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-01-30T23:21:08.000Z (about 4 years ago)
- Last Synced: 2024-11-10T04:37:16.315Z (3 months ago)
- Topics: database, firestore, gcp, streamlit
- Language: Python
- Homepage:
- Size: 871 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# firestore 🔥
Firestore called from Streamlit appshttps://discuss.streamlit.io/t/streamlit-firestore/9224
https://firebase.google.com/docs/firestore
https://googleapis.dev/python/firestore/latest/index.html
## Create a Firestore database 🔥
Start it in test mode, which means anyone can read or write to it for the next 30 days (you can change this later!)![firestore](firestore-create.png)
## SDK Cloud
https://cloud.google.com/sdk
![sdk-cloud](sdk-cloud.png)
## Download account keys 🗝️
To download this JSON file, first go to "Project settings":
![project-dashboard](project-dashboard.png)## Python Client for Google Cloud Firestore
```python
from google.cloud import firestore# Add a new document
db = firestore.Client.from_service_account_json("firestore-key.json")
doc_ref = db.collection(u'users').document(u'alovelace')
doc_ref.set({
u'first': u'Ada',
u'last': u'Lovelace',
u'born': 1815
})# Then query for documents
users_ref = db.collection(u'users')for doc in users_ref.stream():
print(u'{} => {}'.format(doc.id, doc.to_dict()))```
![firestore-console](firestore-console2.png)
[Setup Authentication](https://googleapis.dev/python/google-api-core/latest/auth.html)
`
gcloud auth application-default login
`Credentials saved to file: [C:\Users\badmo\AppData\Roaming\gcloud\application_default_credentials.json]
[C:\Users\badmo\AppData\Roaming\gcloud\application_default_credentials.jsonSource:
https://discuss.streamlit.io/t/streamlit-firestore/9224