/simple-firestore-import

A python script for importing data into Firebase Cloud Firestore

Primary LanguagePythonMIT LicenseMIT

Simple Firestore Import

Easily import data into Firebase Cloud Firestore from json and yaml files.

Installation

Clone the repo:

$ git clone https://github.com/RobinCheptileh/simple-firestore-import.git

Move into the directory:

$ cd simple-firestore-import

Install dependencies:

$ pip install -r requirements.txt

Usage

Provide your Firebase or Google Cloud service account key, data file and the name of the collection.

$ simple-firestore-import.py [path/to/serviceAccount.json] [path/to/dataFile(.json|.yaml|.yml)] [name of collection]

Or without arguments:

$ simple-firestore-import.py
Path to serviceAccountKey.json: [path/to/serviceAccount.json]
Path to data file: [path/to/dataFile(.json|.yaml|.yml)]
Name of collection: [name of collection]

Note

The program expects an array of objects (dictionaries) to work.

CORRECT DATA FILE FORMAT

[
    {
        "name": "Jane Doe",
        "email": "janedoe@mail.com"
    },
    {
        "name": "John Doe",
        "email": "johndoe@mail.com"
    }
]
---
- name: Jane Doe
  email: janedoe@mail.com
- name: John Doe
  email: johndoe@mail.com

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/robincheptileh/simple-firestore-import. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The program is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Simple Firestore Import project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.