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:
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:
- Go to the Google Cloud Console.
- Navigate to IAM & Admin > Service Accounts.
- Create a service account and download the JSON credentials file.
Next, initialize FirestoreDB with your credentials:
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
# 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
# Retrieve a document by name
user_document = db.get_document_data(collection_name='users', document_name='user_johndoe')
print(user_document)
Updating a Document
# 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.
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:
- Fork the repository.
- Create a new branch for your feature or fix.
- 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.
Metadata
Release files for firestore-wrapper 0.3.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| firestore_wrapper-0.3.4.tar.gz | 10.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| firestore_wrapper-0.3.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.8 kB
Release files / firestore_wrapper-0.3.4.tar.gz
| Download URL | firestore_wrapper-0.3.4.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7655d9ccd04c3867409da21a8e4a30a67d7c1990021879f4dcbde608c3a8fd21
|
|
BLAKE2b-256 checksum How to use checksums |
c3ca7e2503eb4e5424e59cb8e21a3161692db5ba7fb8fa3ec4df6f237dce8993
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.9
|
Release files / firestore_wrapper-0.3.4-py3-none-any.whl
| Download URL | firestore_wrapper-0.3.4-py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1407ff0a8440fec9b905f5e867341aface9f427f2c89248c25c5d9247d0900ee
|
|
BLAKE2b-256 checksum How to use checksums |
683c5c5221f84c29889a3380156052d6c02692152b3cd9945468d356ab77797e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.9
|