firestore-wrapper


Namefirestore-wrapper JSON
Version 0.3.4 PyPI version JSON
download
home_pagehttps://github.com/AntonioVentilii/firestore-wrapper
SummaryA custom wrapper for Google Firestore.
upload_time2024-04-13 05:50:15
maintainerNone
docs_urlNone
authorAntonio Ventilii
requires_python>=3.7
licenseMIT
keywords firestore api wrapper database
VCS
bugtrack_url
requirements google-cloud-firestore schema wheel twine
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # firestore-wrapper

`firestore-wrapper` is a custom Python wrapper designed to simplify and streamline operations with Google Firestore. By
abstracting the complexities of direct Firestore interaction, it provides an easier and more Pythonic way to work with
Firestore databases, including document management, querying, and batch operations.

## Features

- Simplified document addition, update, and retrieval
- Batch operations support
- Automated backup and restoration capabilities
- Customizable query methods

## Installation

Install `firestore-wrapper` using pip:

```bash
pip install firestore-wrapper
```

Ensure you have a Google Cloud project with Firestore enabled and service account credentials available.

## Quick Start

First, set up your Firestore credentials:

1. Go to the [Google Cloud Console](https://console.cloud.google.com/).
2. Navigate to IAM & Admin > Service Accounts.
3. Create a service account and download the JSON credentials file.

Next, initialize `FirestoreDB` with your credentials:

```python
from firestore_wrapper import FirestoreDB

# Path to your Firestore credentials JSON file
credentials_path = 'path/to/your/credentials.json'
database_url = 'your-database-url'  # Optional, if using a custom Firestore database

# Initialize the FirestoreDB instance
db = FirestoreDB(credentials_path=credentials_path, database=database_url)
```

### Adding a Document

```python
# Define your document data
data = {
    'name': 'John Doe',
    'email': 'john.doe@example.com',
    'signup_date': '2023-01-01'
}

# Add a document to the 'users' collection
document_name = db.add_document(collection_name='users', data=data, document_name='user_johndoe')
print(f'Document added with name: {document_name}')
```

### Retrieving a Document

```python
# Retrieve a document by name
user_document = db.get_document_data(collection_name='users', document_name='user_johndoe')
print(user_document)
```

### Updating a Document

```python
# Update a document with new data
update_data = {'email': 'new.email@example.com'}
db.update_document(collection_name='users', document_name='user_johndoe', data=update_data)
```

## Getting Help

If you encounter any issues or have questions about using `firestore-wrapper`,
please create an issue in the [GitHub repository](https://github.com/AntonioVentilii/firestore-wrapper/issues).

## Contributing

Contributions to `firestore-wrapper` are welcome!
Whether it's bug reports, feature requests, or code contributions, please feel free to make a contribution. For code
contributions, please:

1. Fork the repository.
2. Create a new branch for your feature or fix.
3. Submit a pull request.

Please ensure your code adheres to the project's coding standards and includes appropriate tests.

## License

`firestore-wrapper` is released under the MIT License. See the LICENSE file for more details.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/AntonioVentilii/firestore-wrapper",
    "name": "firestore-wrapper",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "firestore api wrapper database",
    "author": "Antonio Ventilii",
    "author_email": "antonioventilii@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c3/ca/7e2503eb4e5424e59cb8e21a3161692db5ba7fb8fa3ec4df6f237dce8993/firestore_wrapper-0.3.4.tar.gz",
    "platform": null,
    "description": "# firestore-wrapper\n\n`firestore-wrapper` is a custom Python wrapper designed to simplify and streamline operations with Google Firestore. By\nabstracting the complexities of direct Firestore interaction, it provides an easier and more Pythonic way to work with\nFirestore databases, including document management, querying, and batch operations.\n\n## Features\n\n- Simplified document addition, update, and retrieval\n- Batch operations support\n- Automated backup and restoration capabilities\n- Customizable query methods\n\n## Installation\n\nInstall `firestore-wrapper` using pip:\n\n```bash\npip install firestore-wrapper\n```\n\nEnsure you have a Google Cloud project with Firestore enabled and service account credentials available.\n\n## Quick Start\n\nFirst, set up your Firestore credentials:\n\n1. Go to the [Google Cloud Console](https://console.cloud.google.com/).\n2. Navigate to IAM & Admin > Service Accounts.\n3. Create a service account and download the JSON credentials file.\n\nNext, initialize `FirestoreDB` with your credentials:\n\n```python\nfrom firestore_wrapper import FirestoreDB\n\n# Path to your Firestore credentials JSON file\ncredentials_path = 'path/to/your/credentials.json'\ndatabase_url = 'your-database-url'  # Optional, if using a custom Firestore database\n\n# Initialize the FirestoreDB instance\ndb = FirestoreDB(credentials_path=credentials_path, database=database_url)\n```\n\n### Adding a Document\n\n```python\n# Define your document data\ndata = {\n    'name': 'John Doe',\n    'email': 'john.doe@example.com',\n    'signup_date': '2023-01-01'\n}\n\n# Add a document to the 'users' collection\ndocument_name = db.add_document(collection_name='users', data=data, document_name='user_johndoe')\nprint(f'Document added with name: {document_name}')\n```\n\n### Retrieving a Document\n\n```python\n# Retrieve a document by name\nuser_document = db.get_document_data(collection_name='users', document_name='user_johndoe')\nprint(user_document)\n```\n\n### Updating a Document\n\n```python\n# Update a document with new data\nupdate_data = {'email': 'new.email@example.com'}\ndb.update_document(collection_name='users', document_name='user_johndoe', data=update_data)\n```\n\n## Getting Help\n\nIf you encounter any issues or have questions about using `firestore-wrapper`,\nplease create an issue in the [GitHub repository](https://github.com/AntonioVentilii/firestore-wrapper/issues).\n\n## Contributing\n\nContributions to `firestore-wrapper` are welcome!\nWhether it's bug reports, feature requests, or code contributions, please feel free to make a contribution. For code\ncontributions, please:\n\n1. Fork the repository.\n2. Create a new branch for your feature or fix.\n3. Submit a pull request.\n\nPlease ensure your code adheres to the project's coding standards and includes appropriate tests.\n\n## License\n\n`firestore-wrapper` is released under the MIT License. See the LICENSE file for more details.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A custom wrapper for Google Firestore.",
    "version": "0.3.4",
    "project_urls": {
        "Homepage": "https://github.com/AntonioVentilii/firestore-wrapper",
        "Issue Tracker": "https://github.com/AntonioVentilii/firestore-wrapper/issues",
        "Source Code": "https://github.com/AntonioVentilii/firestore-wrapper"
    },
    "split_keywords": [
        "firestore",
        "api",
        "wrapper",
        "database"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "683c5c5221f84c29889a3380156052d6c02692152b3cd9945468d356ab77797e",
                "md5": "dce5ec6fd93e40e15e9cb366fd912ccc",
                "sha256": "1407ff0a8440fec9b905f5e867341aface9f427f2c89248c25c5d9247d0900ee"
            },
            "downloads": -1,
            "filename": "firestore_wrapper-0.3.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dce5ec6fd93e40e15e9cb366fd912ccc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 12647,
            "upload_time": "2024-04-13T05:50:13",
            "upload_time_iso_8601": "2024-04-13T05:50:13.678623Z",
            "url": "https://files.pythonhosted.org/packages/68/3c/5c5221f84c29889a3380156052d6c02692152b3cd9945468d356ab77797e/firestore_wrapper-0.3.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c3ca7e2503eb4e5424e59cb8e21a3161692db5ba7fb8fa3ec4df6f237dce8993",
                "md5": "f3d33d3b73657f795cb561b186c101b6",
                "sha256": "7655d9ccd04c3867409da21a8e4a30a67d7c1990021879f4dcbde608c3a8fd21"
            },
            "downloads": -1,
            "filename": "firestore_wrapper-0.3.4.tar.gz",
            "has_sig": false,
            "md5_digest": "f3d33d3b73657f795cb561b186c101b6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 10178,
            "upload_time": "2024-04-13T05:50:15",
            "upload_time_iso_8601": "2024-04-13T05:50:15.580147Z",
            "url": "https://files.pythonhosted.org/packages/c3/ca/7e2503eb4e5424e59cb8e21a3161692db5ba7fb8fa3ec4df6f237dce8993/firestore_wrapper-0.3.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-13 05:50:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "AntonioVentilii",
    "github_project": "firestore-wrapper",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "google-cloud-firestore",
            "specs": []
        },
        {
            "name": "schema",
            "specs": []
        },
        {
            "name": "wheel",
            "specs": []
        },
        {
            "name": "twine",
            "specs": []
        }
    ],
    "lcname": "firestore-wrapper"
}
        
Elapsed time: 1.66060s