firestore-batch-0.0.1
توضیحات
A simple Python context manager for easy Google Forestore batched writes.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | firestore-batch-0.0.1 |
| نام | firestore-batch |
| نسخه کتابخانه | 0.0.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Alexey Leshchenko |
| ایمیل نویسنده | leshchenko@gmail.com |
| آدرس صفحه اصلی | https://github.com/leshchenko1979/firestore-batch |
| آدرس اینترنتی | https://pypi.org/project/firestore-batch/ |
| مجوز | MIT |
# 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:
```python
# 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 original `WriteBatch` class (see [the documentation with usage examples](https://firebase.google.com/docs/firestore/manage-data/transactions?hl=en#batched-writes) and API Reference for the [`WriteBatch`](https://googleapis.dev/python/firestore/latest/batch.html) and [`DocumentReference`](https://googleapis.dev/python/firestore/latest/document.html) classes).
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl firestore-batch-0.0.1:
pip install firestore-batch-0.0.1.whl
نصب پکیج tar.gz firestore-batch-0.0.1:
pip install firestore-batch-0.0.1.tar.gz