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 | Provenance | Actions |
|---|---|---|---|---|
| firestore_size-1.0.1.tar.gz | 3.5 kB | Without provenance | Details for firestore_size-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| firestore_size-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for firestore_size-1.0.1-py3-none-any.whl |
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
|
Security for firestore-size 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.