Command-line tool for querying/updating firestore
Project description
Firestore CLI
This CLI tool allows you to interact with Google Firestore using command-line commands. It includes two main scripts: fsquery and fsupdate.
Installation
-
Install from PyPI:
pip install firestore-cli
Usage
Credentials
To specify the credentials necessary to access Firestore, you can use either of the following methods:
-
Using the
--credentialsoption:Provide the path to the Firebase credentials JSON file directly via the
--credentialscommand-line option. Example usage:fsquery --credentials /path/to/your/credentials.json --path your/firestore/collection -
Using the
GOOGLE_APPLICATION_CREDENTIALSenvironment variable: Set theGOOGLE_APPLICATION_CREDENTIALSenvironment variable to the path of your Firebase credentials JSON file. Example usage:export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/credentials.json fsquery --path your/firestore/collection
If neither method is provided, the script will attempt to use the default application credentials (which probably won't go well)
fsquery
The fsquery script allows you to query documents from a Firestore collection.
Command Line Options
--path: Path to the Firestore collection (required).--group: Specify if this is a collection group query (optional).--where: Apply multiple filters to the query in the formatfield:operation:valuee.g.--where "some_field == some_value"(optional). It is recommended to place quotes around the expression.--id: Query for a specific document ID (optional).--orderby: Order the results by specified fields, followed byASCENDINGorDESCENDING(optional).--limit: Limit the number of results (optional).
Examples
-
Query all documents in a collection:
fsquery --path your-collection
-
Query documents with a filter:
fsquery --path your-collection --where "field_name == value"
fsupdate
The fsupdate script allows you to set, add, update, or delete documents in a Firestore collection.
Command Line Options
--path: Path to the Firestore collection (required).--set: Set a document with the specified ID.--add: Add a new document.--update: Update a document with the specified ID.--delete: Delete a document with the specified ID.--doc: Path to the JSON file containing the document data.
Examples
-
Set a document:
fsupdate --path your-collection --set your-document-id --doc path/to/your/document.json
-
Add a document:
fsupdate --path your-collection --add --doc path/to/your/document.json
-
Update a document:
fsupdate --path your-collection --update your-document-id --doc path/to/your/document.json
-
Delete a document:
fsupdate --path your-collection --delete your-document-id
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file firestore_cli-0.1.3.tar.gz.
File metadata
- Download URL: firestore_cli-0.1.3.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8ef2b32bb0a12ca0a9a8c789463a56578b89f4b6aadf3fe49a88b41ba44b308
|
|
| MD5 |
5c47db796e86bcd1e52ec4f04ad3e702
|
|
| BLAKE2b-256 |
3c97167de4476cc409c2c05dde1a94a9750b95eb1dad8e467b975baaf0a7ec43
|
File details
Details for the file firestore_cli-0.1.3-py3-none-any.whl.
File metadata
- Download URL: firestore_cli-0.1.3-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8bcd93cee65492283c86c9b6553cd31bebd2149a7a2cec12929fcacdb83b8d7c
|
|
| MD5 |
fd2432b0648c08833fd33f315367ad5f
|
|
| BLAKE2b-256 |
3d339a6074111de7ef3e9fb3d414d63b9208f0cc580ba7a605f515624aacf4a3
|