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 one with not too many option 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?
- 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_CREDENTIALS
environment variable to the json file. For e.g. in Linuxexport GOOGLE_APPLICATION_CREDENTIALS="google-cloud.json"
- Import
FirestoreDocument
fromfirestore_ci
- Make your object model using
FirestoreDocument
For 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.py
file
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
firestore-ci-2020.8.14.tar.gz
(5.9 kB
view hashes)
Built Distribution
Close
Hashes for firestore_ci-2020.8.14-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95fb8a7872d256f87cded9b36730264f63b06b06a5273b04a709d820a9f9fc7b |
|
MD5 | b5de2e2ddd472ac475d7b250b77e3767 |
|
BLAKE2b-256 | 45f0e74f2945f9a0abae1d8628b82977aa2b27cb8a00a68df4bf9e4fe97f299b |