firestore_size
Python library to calculate the approximate size of a firestore document. This can be used for firebase storage cost analysis, among other things.
Installation
pip install firestore_size
Usage
from firestore_size.calculate import document_size
# initialize firebase and firestore client
collection = db.collection("data")
doc = collection.doc(id).get()
data = doc.to_dict()
doc_size = document_size(data)
print("Doc Size is ", doc_size)
How it calculates?
Checkout how the size of firestore docs is calculated in documentation.
Brief description is
- Array - The sum of the sizes of its values
- Boolean - 1 byte
- Bytes - Byte length
- Date and time - 8 bytes
- Floating-point number - 8 bytes
- Geographical point - 16 bytes
- Integer - 8 bytes
- Map - The size of the map, calculated the same way as document size
- Null - 1 byte
- Reference - The document name size
- Text string - Number of UTF-8 encoded bytes + 1
What is not included?
Does not take into account the name of a document, check docs on how it's calculated.
Does not take into account indexing. Indexes can be disabled - docs - to free up more space.
How to contribute?
Create issues for any bugs caught. Fork the repo to your account and send pull request with your changes.
Run tests using
python3 setup.py pytest
Metadata
Release files for firestore-size 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| firestore_size-1.0.1.tar.gz | 3.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| firestore_size-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.3 kB
Release files / firestore_size-1.0.1.tar.gz
| Download URL | firestore_size-1.0.1.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bf0837786fb9ea0ca6e9f2eadeff14bcf07886b1c1eaaef3ec9722f80cf5ec38
|
|
BLAKE2b-256 checksum How to use checksums |
5de7b6a7d040f1e21d86af58c34dc87d16339e753359dbbf565e2aeee4b3448f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.12
|
Release files / firestore_size-1.0.1-py3-none-any.whl
| Download URL | firestore_size-1.0.1-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9cac51b0474dc9011f2f00b5ff719fce291337b695171a25d5efa1e9cd4d3247
|
|
BLAKE2b-256 checksum How to use checksums |
7068f1f4ac5b4d0c094c236fb224df6e6f164ba865419ddb86462d0658b8c4fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.12
|