Google Firestore ORM
This is yet another attempt to create an ORM for Google Firestore Database. This one is relatively simple with not too many options to customize. In fact, the entire source code is in one file firestore-ci.py.
Features
- Provide multi-thread interface to simulate async interaction with firestore.
- A truncate feature to only create fields with non-default values in firestore.
- A cascade feature: This will be removed in future release.
How to use for Google Cloud Firestore?
- Install firestore-ci
pip install firestore-ci - Save the GCP service-account JSON key in your project folder & give it a name. For e.g.
google-cloud.json - Set the
GOOGLE_APPLICATION_CREDENTIALSenvironment variable to the JSON file. For e.g., in Linuxexport GOOGLE_APPLICATION_CREDENTIALS="google-cloud.json"
How to use with Firestore Emulator?
- Install firestore-ci
pip install firestore-ci - Start the Firestore Emulator.
- Set up the environment variables
FIRESTORE_EMULATOR_HOSTwith the ip address of the emulator andFIRESTORE_EMULATOR_PROJECT_IDwith the project id that the emulator is using.
How to use with Firestore Emulator?
- Import
FirestoreDocumentfromfirestore_ci - Make your object model using
FirestoreDocumentFor e.g.class User(FirestoreDocument) - Override the
__init__()method to add your fields - Outside the model, call the
init()method of Firestore document. For e.g.User.init() - Here is a sample
models.pyfile
from firestore_ci import FirestoreDocument
class User(FirestoreDocument):
def __init__(self):
super().__init__()
self.name = str()
self.email = str()
User.init()
Test
The unit test cases for this package can be found here. The test cases are self-explanatory and reviewing them will help understanding this package better.
Metadata
Release files for firestore-ci 2024.8.24
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_ci-2024.8.24.tar.gz | 7.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| firestore_ci-2024.8.24-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.7 kB
Release files / firestore_ci-2024.8.24.tar.gz
| Download URL | firestore_ci-2024.8.24.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5fd38cabfc943c91d33cd54e20bed71bf3dc7ad8a5f15eb5bfe2bcc8d7124037
|
|
BLAKE2b-256 checksum How to use checksums |
286ac9b9fad474a5d75b22c95d3371ad92ab4d627bd59e69ec987d7bcfa172e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.5
|
Release files / firestore_ci-2024.8.24-py3-none-any.whl
| Download URL | firestore_ci-2024.8.24-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9141eef4542b1640412cc7ce6a690c5c9bbee2c12177d3f56b30b9a25060f22d
|
|
BLAKE2b-256 checksum How to use checksums |
f29e3f71444ffe80bc370811f05116249b0c7ca511c4410eea9ec4d0f8b6631b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.5
|