Skip to main content

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

  1. Provide multi-thread interface to simulate async interaction with firestore.
  2. A truncate feature to only create fields with non-default values in firestore.
  3. A cascade feature: This will be removed in future release.

How to use for Google Cloud Firestore?

  1. Install firestore-ci pip install firestore-ci
  2. Save the GCP service-account JSON key in your project folder & give it a name. For e.g. google-cloud.json
  3. Set the GOOGLE_APPLICATION_CREDENTIALS environment variable to the JSON file. For e.g., in Linux export GOOGLE_APPLICATION_CREDENTIALS="google-cloud.json"

How to use with Firestore Emulator?

  1. Install firestore-ci pip install firestore-ci
  2. Start the Firestore Emulator.
  3. Set up the environment variables FIRESTORE_EMULATOR_HOST with the ip address of the emulator and FIRESTORE_EMULATOR_PROJECT_ID with the project id that the emulator is using.

How to use with Firestore Emulator?

  1. Import FirestoreDocument from firestore_ci
  2. Make your object model using FirestoreDocument For e.g. class User(FirestoreDocument)
  3. Override the __init__() method to add your fields
  4. Outside the model, call the init() method of Firestore document. For e.g. User.init()
  5. 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.

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)

Source distribution for firestore-ci 2024.8.24
File Size Uploaded
firestore_ci-2024.8.24.tar.gz 7.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for firestore-ci 2024.8.24
File Interpreter ABI Platform
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
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page