# 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
```python
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](https://github.com/crazynayan/firestore-test).
The test cases are self-explanatory and reviewing them will help understanding this package better.
Raw data
{
"_id": null,
"home_page": "https://github.com/crazynayan/firestore",
"name": "firestore-ci",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.5",
"maintainer_email": null,
"keywords": "firestore google orm cascade",
"author": "Nayan Zaveri",
"author_email": "nayan@crazyideas.co.in",
"download_url": "https://files.pythonhosted.org/packages/28/6a/c9b9fad474a5d75b22c95d3371ad92ab4d627bd59e69ec987d7bcfa172e7/firestore_ci-2024.8.24.tar.gz",
"platform": null,
"description": "# Google Firestore ORM\r\n\r\nThis is yet another attempt to create an ORM for Google Firestore Database. \r\nThis one is relatively simple with not too many options to customize.\r\nIn fact, the entire source code is in one file firestore-ci.py.\r\n\r\n## Features\r\n1. Provide multi-thread interface to simulate async interaction with firestore.\r\n2. A truncate feature to only create fields with non-default values in firestore.\r\n3. A cascade feature: This will be removed in future release.\r\n\r\n## How to use for Google Cloud Firestore?\r\n1. Install firestore-ci `pip install firestore-ci`\r\n2. Save the GCP service-account JSON key in your project folder & give it a name. For e.g. `google-cloud.json`\r\n3. Set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to the JSON file. \r\nFor e.g., in Linux `export GOOGLE_APPLICATION_CREDENTIALS=\"google-cloud.json\"`\r\n\r\n## How to use with Firestore Emulator?\r\n1. Install firestore-ci `pip install firestore-ci`\r\n2. Start the Firestore Emulator.\r\n3. 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.\r\n\r\n\r\n## How to use with Firestore Emulator?\r\n1. Import `FirestoreDocument` from `firestore_ci` \r\n2. Make your object model using `FirestoreDocument` For e.g. `class User(FirestoreDocument)`\r\n3. Override the `__init__()` method to add your fields\r\n4. Outside the model, call the `init()` method of Firestore document. For e.g. `User.init()` \r\n5. Here is a sample `models.py` file\r\n```python\r\nfrom firestore_ci import FirestoreDocument\r\n\r\nclass User(FirestoreDocument):\r\n def __init__(self):\r\n super().__init__()\r\n self.name = str()\r\n self.email = str()\r\n\r\nUser.init()\r\n```\r\n\r\n## Test\r\nThe unit test cases for this package can be found [here](https://github.com/crazynayan/firestore-test). \r\nThe test cases are self-explanatory and reviewing them will help understanding this package better.\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "ORM for Firestore with cascade",
"version": "2024.8.24",
"project_urls": {
"Homepage": "https://github.com/crazynayan/firestore"
},
"split_keywords": [
"firestore",
"google",
"orm",
"cascade"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f29e3f71444ffe80bc370811f05116249b0c7ca511c4410eea9ec4d0f8b6631b",
"md5": "f24a895885c4ead230922f683dd71ecd",
"sha256": "9141eef4542b1640412cc7ce6a690c5c9bbee2c12177d3f56b30b9a25060f22d"
},
"downloads": -1,
"filename": "firestore_ci-2024.8.24-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f24a895885c4ead230922f683dd71ecd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.5",
"size": 7368,
"upload_time": "2024-08-24T10:18:44",
"upload_time_iso_8601": "2024-08-24T10:18:44.130009Z",
"url": "https://files.pythonhosted.org/packages/f2/9e/3f71444ffe80bc370811f05116249b0c7ca511c4410eea9ec4d0f8b6631b/firestore_ci-2024.8.24-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "286ac9b9fad474a5d75b22c95d3371ad92ab4d627bd59e69ec987d7bcfa172e7",
"md5": "30f86024d5392a6c49936cbe79363832",
"sha256": "5fd38cabfc943c91d33cd54e20bed71bf3dc7ad8a5f15eb5bfe2bcc8d7124037"
},
"downloads": -1,
"filename": "firestore_ci-2024.8.24.tar.gz",
"has_sig": false,
"md5_digest": "30f86024d5392a6c49936cbe79363832",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.5",
"size": 7308,
"upload_time": "2024-08-24T10:18:45",
"upload_time_iso_8601": "2024-08-24T10:18:45.904045Z",
"url": "https://files.pythonhosted.org/packages/28/6a/c9b9fad474a5d75b22c95d3371ad92ab4d627bd59e69ec987d7bcfa172e7/firestore_ci-2024.8.24.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-24 10:18:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "crazynayan",
"github_project": "firestore",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "cachetools",
"specs": [
[
"==",
"5.5.0"
]
]
},
{
"name": "certifi",
"specs": [
[
"==",
"2024.7.4"
]
]
},
{
"name": "charset-normalizer",
"specs": [
[
"==",
"3.3.2"
]
]
},
{
"name": "google-api-core",
"specs": [
[
"==",
"2.19.1"
]
]
},
{
"name": "google-auth",
"specs": [
[
"==",
"2.34.0"
]
]
},
{
"name": "google-cloud-core",
"specs": [
[
"==",
"2.4.1"
]
]
},
{
"name": "google-cloud-firestore",
"specs": [
[
"==",
"2.17.2"
]
]
},
{
"name": "googleapis-common-protos",
"specs": [
[
"==",
"1.63.2"
]
]
},
{
"name": "grpcio",
"specs": [
[
"==",
"1.66.0"
]
]
},
{
"name": "grpcio-status",
"specs": [
[
"==",
"1.66.0"
]
]
},
{
"name": "idna",
"specs": [
[
"==",
"3.8"
]
]
},
{
"name": "proto-plus",
"specs": [
[
"==",
"1.24.0"
]
]
},
{
"name": "protobuf",
"specs": [
[
"==",
"5.27.3"
]
]
},
{
"name": "pyasn1",
"specs": [
[
"==",
"0.6.0"
]
]
},
{
"name": "pyasn1_modules",
"specs": [
[
"==",
"0.4.0"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.32.3"
]
]
},
{
"name": "rsa",
"specs": [
[
"==",
"4.9"
]
]
},
{
"name": "setuptools",
"specs": [
[
"==",
"73.0.1"
]
]
},
{
"name": "urllib3",
"specs": [
[
"==",
"2.2.2"
]
]
}
],
"lcname": "firestore-ci"
}