Skip to content

Feature Request: Support for User-Defined Data Types in Import Config File #8

Description

@RexBytes

Background & Current Approach:

The CSVDataImporter tool is currently designed to import CSV data into a PostgreSQL database by treating all columns as text initially. This approach offers several key advantages:

  • Data Integrity: By importing all data as text, it avoids issues related to automatic type conversion that might discard or misinterpret data during the import process.
  • Flexibility: Users have full control over how data is interpreted and transformed once it's safely imported into the database. This is especially useful when dealing with inconsistent or dirty datasets where column values might vary.
  • Error Handling: Any anomalies or edge cases (e.g., unexpected characters in a numeric field) can be addressed directly in the database before type conversions, ensuring that no data is lost during the import.

This method is effective in preserving data but requires users to convert data types within the database, which can add an extra step in the data import workflow.

Feature Request: Expand Config File to Allow User-Defined Data Types

As a future enhancement, it would be highly beneficial to expand the YAML configuration file to allow users to specify desired data types for each column during the import process. This feature would streamline the data import workflow by enabling users to define how each column should be interpreted directly in the configuration file.

Motivation for the Feature:

  • Streamlining Data Import: Allowing users to define data types like INTEGER, FLOAT, DATE, etc., would reduce the need for post-import transformations in the database, saving time and computational resources.
  • Adaptability to Diverse Data Sources: Users could adapt the tool to handle various data sources more easily, without manual intervention in the database for common type conversions.

Potential Challenges with Dirty Data:

  • Data Consistency Issues: Introducing data type definitions at the import stage could lead to challenges when encountering dirty or inconsistent data. For example, if a user defines a column as INTEGER in the configuration file but the CSV contains non-numeric values (e.g., "N/A", "undefined"), the import process could fail or result in data loss.
  • Need for Robust Validation: The tool would need to include validation and fallback mechanisms to handle cases where data doesn’t match the specified types, such as logging problematic rows or allowing users to define default values for conversion failures.

Conclusion:

This feature request aims to preserve the current strengths of the text-only import method while providing users with the option for more precise data handling during import. By expanding the YAML configuration file to support user-defined data types, the tool can offer a smoother experience for users dealing with diverse datasets while maintaining flexibility and control.

CSVDataExporter may need a similar look, but a full text output seems to preserve formatting very well.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions