firestore-batch
A Python context manager for easy Google Forestore batched writes.
What it does for you
- Creates a new batch on entering.
- Takes care of the 500-operation limit. When the limit is hit, it commits accumulated operations to the database and creates a new batch.
- Commits all operations on exit.
Usage
Install with pip:
pip install firestore-batch
Use in your code:
# Initialize the app
from firebase_admin import initialize_app, firestore
initialize_app()
db = firestore.client()
# Make lots of batched writes
from firestore_batch import Batch
with Batch(db) as batch:
for i in range(1000):
batch.set(doc_ref, {f'property_{i}': f'value_{i}'})
Methods
set(),update(),delete()- as in the originalWriteBatchclass (see the documentation with usage examples and API Reference for theWriteBatchandDocumentReferenceclasses).
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
firestore_batch-0.0.1.tar.gz
(2.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file firestore_batch-0.0.1.tar.gz.
File metadata
- Download URL: firestore_batch-0.0.1.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb1908c9f5d5cce87366c27ae09e7f6e9e8bf0b27b9b07a778b9828b895b5ad4
|
|
| MD5 |
843a61bf101610c9ba4328cdee32300a
|
|
| BLAKE2b-256 |
a2da008c5873d1cfb72516e56a68290164164f78e23e74230d72903f72309820
|
File details
Details for the file firestore_batch-0.0.1-py3-none-any.whl.
File metadata
- Download URL: firestore_batch-0.0.1-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ba8323a9947147587e9ca07ca97bf610261301c2f0f0aa6e9bada60cd007031
|
|
| MD5 |
73ccba9a7eede0af5a1c5f58d4dd4d00
|
|
| BLAKE2b-256 |
fb404426819cb502847fdea2801fc75e0c3312ec3d0d0ecebde935ba2276cfc4
|