ORM for Firestore with cascade
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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_ci-2024.8.24.tar.gz.
File metadata
- Download URL: firestore_ci-2024.8.24.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fd38cabfc943c91d33cd54e20bed71bf3dc7ad8a5f15eb5bfe2bcc8d7124037
|
|
| MD5 |
30f86024d5392a6c49936cbe79363832
|
|
| BLAKE2b-256 |
286ac9b9fad474a5d75b22c95d3371ad92ab4d627bd59e69ec987d7bcfa172e7
|
File details
Details for the file firestore_ci-2024.8.24-py3-none-any.whl.
File metadata
- Download URL: firestore_ci-2024.8.24-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9141eef4542b1640412cc7ce6a690c5c9bbee2c12177d3f56b30b9a25060f22d
|
|
| MD5 |
f24a895885c4ead230922f683dd71ecd
|
|
| BLAKE2b-256 |
f29e3f71444ffe80bc370811f05116249b0c7ca511c4410eea9ec4d0f8b6631b
|