Skip to main content

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

  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.

Project details


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-2024.8.24.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

firestore_ci-2024.8.24-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

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

Hashes for firestore_ci-2024.8.24.tar.gz
Algorithm Hash digest
SHA256 5fd38cabfc943c91d33cd54e20bed71bf3dc7ad8a5f15eb5bfe2bcc8d7124037
MD5 30f86024d5392a6c49936cbe79363832
BLAKE2b-256 286ac9b9fad474a5d75b22c95d3371ad92ab4d627bd59e69ec987d7bcfa172e7

See more details on using hashes here.

File details

Details for the file firestore_ci-2024.8.24-py3-none-any.whl.

File metadata

File hashes

Hashes for firestore_ci-2024.8.24-py3-none-any.whl
Algorithm Hash digest
SHA256 9141eef4542b1640412cc7ce6a690c5c9bbee2c12177d3f56b30b9a25060f22d
MD5 f24a895885c4ead230922f683dd71ecd
BLAKE2b-256 f29e3f71444ffe80bc370811f05116249b0c7ca511c4410eea9ec4d0f8b6631b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page