Fuego

Data Import for Firestore

big-idea

Overview

The document import functionality in Fuego allows users to seamlessly import structured data into Firestore collections. It supports various file formats, including CSV and JSONL, providing options for document creation, updating, and merging.

Import documents into firestore

Import Process

  1. Select File: Choose the file to import. Supported formats:

    • CSV (with automatic type conversion for numeric, boolean, and null values, though inconsistencies may arise)
    • JSONL (recommended for best compatibility and consistent formatting)
  2. Import Options:

    • Create new documents if not present: If enabled, new documents will be generated whenever an ID is not found in the existing collection.
    • Use __path__ field: If present, this field dictates document paths within Firestore’s hierarchy, allowing for structured organization.
    • Alternative Document ID Field: If specified, this field serves as a fallback identifier when __name__ is unavailable. This ensures flexibility in managing unique document IDs.
  3. Update Modes:

    • Overwrite: Completely replaces existing documents, discarding any previous data.
    • Merge: Integrates new data into existing documents while retaining unchanged fields. This method is useful for incremental updates.
    • Update: Modifies only explicitly designated fields without affecting the rest of the document. This is ideal for targeted field-level modifications.

Additional Settings

  • Attribute Handling:
    • Retain all attributes included in the import file, ensuring completeness in data import.
    • Exclude specific attributes from the import process when creating or updating documents to avoid unintended changes.
  • Special Value Conversions:
    • Convert specific string values, such as timestamps, GeoPoints, and Firestore references, to their appropriate data types.
    • Utilize special placeholders such as __DELETE__ to remove attributes dynamically or __SERVER_TIMESTAMP__ for automatic timestamping during import.
  • CSV-Specific Settings:
    • Define the delimiter used in the CSV file. The default delimiter is a comma (,), but users can modify this based on their file structure.
    • Handle inconsistent data formatting by ensuring all fields adhere to Firestore’s expected data types.

Import Warnings

  • File Format Considerations: CSV imports may lead to inconsistencies due to type conversion limitations. JSONL is recommended for optimal data integrity.
  • Type Conversion Rules: Automatic conversions apply to numeric, boolean, and null values in CSV files. Users should verify that their data structure aligns with Firestore’s expectations.
  • Handling Special Values: Reserved placeholders such as __DELETE__ and __SERVER_TIMESTAMP__ will always be interpreted according to Firestore’s specifications, ensuring appropriate data transformations.

Finalizing the Import

Once all settings have been configured to the user’s preference, clicking Confirm will initiate the import process. Users can monitor progress and review imported data within the Firestore database. Additionally, to streamline future imports, preferences can be saved for reuse, reducing configuration time and ensuring consistency across multiple data import sessions.