https://github.com/bijx/firestore-data-fetcher
A simple Python script to fetch documents from a Firebase Firestore collection and save them to a local `.json` file.
https://github.com/bijx/firestore-data-fetcher
automation data database downloader exporter fetcher firebase firestore open-source script
Last synced: 8 months ago
JSON representation
A simple Python script to fetch documents from a Firebase Firestore collection and save them to a local `.json` file.
- Host: GitHub
- URL: https://github.com/bijx/firestore-data-fetcher
- Owner: bijx
- License: mit
- Created: 2023-08-08T07:05:41.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-08-08T07:10:27.000Z (over 2 years ago)
- Last Synced: 2025-02-28T12:56:40.245Z (11 months ago)
- Topics: automation, data, database, downloader, exporter, fetcher, firebase, firestore, open-source, script
- Language: Python
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Firebase Firestore Data Fetcher
A simple Python script to fetch documents from a Firebase Firestore collection and save them to a local `.json` file. Helpful when your project is on the free tier and you don't want to enable billing on your account.
## Prerequisites
- Python 3.6+
- Firebase project with Firestore enabled
## Setup
1. Clone the repository:
```
git clone https://github.com/bijx/Firestore-Data-Fetcher.git
```
2. Navigate to the project directory:
```
cd Firestore-Data-Fetcher
```
3. Install the required packages:
```
pip install firebase-admin
```
4. Obtain your Firebase service account key:
- Go to the Firebase Console.
- Navigate to your project.
- Click on "Project settings".
- Click on the "Service accounts" tab.
- Generate a new private key.
- Save the `.json` file with your credentials to the project directory.
## Usage
1. Open the script and replace `'collection_name'` with the name of the Firestore collection you want to fetch.
2. Run the script:
```
python script.py
```
3. The data will be saved in a file named `output.json`.
## Notes
- Just a word of caution: Always keep your Firebase service account key secure and never expose it in public locations.