-
Notifications
You must be signed in to change notification settings - Fork 395
[ui-importer] Public API integration #4137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Improves file handling with dedicated metadata detection API: - Adds API error handler decorator for consistent error responses - Introduces libmagic for more reliable file type detection - Separates upload and metadata detection functionality - Adds support for TSV files and multiple sheet Excel detection - Enhances metadata output with column types and sample data Removes commented-out legacy format detection code
Adds new endpoint for file metadata detection functionality Introduces python-magic library for file type detection Adds polars with calamine support for enhanced data handling Updates URL pattern for file upload endpoint to be more precise with trailing slash handling
Extracts file processing logic into a separate operation module Adds TSV to supported file formats Updates API documentation with clearer descriptions The change simplifies the upload endpoint by moving file handling logic to a dedicated operation, making the code more maintainable and easier to test.
Changes the file metadata detection endpoint to be more efficient and accurate: - Renames endpoint from 'detect_metadata' to 'guess_metadata' - Switches to GET method and improves parameter handling - Optimizes file reading by using sampling instead of full file loads - Simplifies metadata response to include only essential information - Adds support for both local and remote file systems - Improves memory usage by using file streams and BytesIO The changes make the API more RESTful and improve performance for large files by using content sampling.
Changes request data source from body to query params for file metadata Adds proper UTF-8 decoding for file samples Enhances error logging with full stack traces Improves robustness of CSV/delimited file handling by properly handling byte streams Removes unnecessary file existence check that could cause false negatives
Enhances file type detection reliability by: - Adding proper error handling for python-magic import - Removing dependency on file extensions for type detection - Simplifying delimiter-based file format detection logic - Improving error messaging when magic lib is unavailable Makes file type detection more robust and maintainable by focusing on content analysis rather than extensions.
Implements new preview endpoint to support file imports with: - Excel file preview with sheet selection - Delimited file preview (CSV, TSV) with configurable separators - SQL type mapping for multiple dialects (Hive, Impala, Trino, Phoenix, SparkSQL) - Automatic header detection - Error handling improvements for file processing Enhances the importer API with robust data preview capabilities before import
✅ Test files were modified. Ensure that the tests cover all relevant changes. ✅ |
Improves file handling with dedicated metadata detection API: - Adds API error handler decorator for consistent error responses - Introduces libmagic for more reliable file type detection - Separates upload and metadata detection functionality - Adds support for TSV files and multiple sheet Excel detection - Enhances metadata output with column types and sample data Removes commented-out legacy format detection code
Adds new endpoint for file metadata detection functionality Introduces python-magic library for file type detection Adds polars with calamine support for enhanced data handling Updates URL pattern for file upload endpoint to be more precise with trailing slash handling
Extracts file processing logic into a separate operation module Adds TSV to supported file formats Updates API documentation with clearer descriptions The change simplifies the upload endpoint by moving file handling logic to a dedicated operation, making the code more maintainable and easier to test.
Changes the file metadata detection endpoint to be more efficient and accurate: - Renames endpoint from 'detect_metadata' to 'guess_metadata' - Switches to GET method and improves parameter handling - Optimizes file reading by using sampling instead of full file loads - Simplifies metadata response to include only essential information - Adds support for both local and remote file systems - Improves memory usage by using file streams and BytesIO The changes make the API more RESTful and improve performance for large files by using content sampling.
Changes request data source from body to query params for file metadata Adds proper UTF-8 decoding for file samples Enhances error logging with full stack traces Improves robustness of CSV/delimited file handling by properly handling byte streams Removes unnecessary file existence check that could cause false negatives
Enhances file type detection reliability by: - Adding proper error handling for python-magic import - Removing dependency on file extensions for type detection - Simplifying delimiter-based file format detection logic - Improving error messaging when magic lib is unavailable Makes file type detection more robust and maintainable by focusing on content analysis rather than extensions.
Implements new preview endpoint to support file imports with: - Excel file preview with sheet selection - Delimited file preview (CSV, TSV) with configurable separators - SQL type mapping for multiple dialects (Hive, Impala, Trino, Phoenix, SparkSQL) - Automatic header detection - Error handling improvements for file processing Enhances the importer API with robust data preview capabilities before import
92bb7d1
to
5ed73c2
Compare
…to feat/importer-6
Improves file handling with dedicated metadata detection API: - Adds API error handler decorator for consistent error responses - Introduces libmagic for more reliable file type detection - Separates upload and metadata detection functionality - Adds support for TSV files and multiple sheet Excel detection - Enhances metadata output with column types and sample data Removes commented-out legacy format detection code
Adds new endpoint for file metadata detection functionality Introduces python-magic library for file type detection Adds polars with calamine support for enhanced data handling Updates URL pattern for file upload endpoint to be more precise with trailing slash handling
Extracts file processing logic into a separate operation module Adds TSV to supported file formats Updates API documentation with clearer descriptions The change simplifies the upload endpoint by moving file handling logic to a dedicated operation, making the code more maintainable and easier to test.
Changes the file metadata detection endpoint to be more efficient and accurate: - Renames endpoint from 'detect_metadata' to 'guess_metadata' - Switches to GET method and improves parameter handling - Optimizes file reading by using sampling instead of full file loads - Simplifies metadata response to include only essential information - Adds support for both local and remote file systems - Improves memory usage by using file streams and BytesIO The changes make the API more RESTful and improve performance for large files by using content sampling.
Changes request data source from body to query params for file metadata Adds proper UTF-8 decoding for file samples Enhances error logging with full stack traces Improves robustness of CSV/delimited file handling by properly handling byte streams Removes unnecessary file existence check that could cause false negatives
Enhances file type detection reliability by: - Adding proper error handling for python-magic import - Removing dependency on file extensions for type detection - Simplifying delimiter-based file format detection logic - Improving error messaging when magic lib is unavailable Makes file type detection more robust and maintainable by focusing on content analysis rather than extensions.
Implements new preview endpoint to support file imports with: - Excel file preview with sheet selection - Delimited file preview (CSV, TSV) with configurable separators - SQL type mapping for multiple dialects (Hive, Impala, Trino, Phoenix, SparkSQL) - Automatic header detection - Error handling improvements for file processing Enhances the importer API with robust data preview capabilities before import
5ed73c2
to
04bcf00
Compare
7771b36
to
f0d3ecb
Compare
583a86d
to
708e75a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request integrates the updated public API endpoints and adapts the importer code to the new data formats and type names. Key changes include updating utility functions and type definitions (e.g., using FilePreviewTableColumn and FilePreviewResponse), revising API endpoint configurations, and modifying UI components and tests to work with the new API responses and settings.
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
desktop/core/src/desktop/js/apps/newimporter/utils/utils.ts | Updated column conversion using toCamelCase and revised data source generation based on FilePreviewResponse. |
desktop/core/src/desktop/js/apps/newimporter/utils/utils.test.ts | Updated tests to reflect the new FilePreview table column and data types. |
desktop/core/src/desktop/js/apps/newimporter/types.ts | Renamed types (e.g., GuessFieldTypesColumn to FilePreviewTableColumn) and refined interface definitions. |
desktop/core/src/desktop/js/apps/newimporter/constants.ts | Modified enum values and updated source configuration to include a new sheet name option. |
desktop/core/src/desktop/js/apps/newimporter/api.ts | Revised API endpoint URLs to match the new public API routes. |
desktop/core/src/desktop/js/apps/newimporter/ImporterSourceSelector/ImporterSourceSelector.tsx | Changed response field mapping to use the updated file API field names. |
desktop/core/src/desktop/js/apps/newimporter/ImporterFilePreview/SourceConfiguration/SourceConfiguration.tsx | Adjusted input handling and updated the onChange signature to work with CombinedFileFormat. |
desktop/core/src/desktop/js/apps/newimporter/ImporterFilePreview/SourceConfiguration/SourceConfiguration.test.tsx | Updated tests to account for new select element expectations based on file type. |
desktop/core/src/desktop/js/apps/newimporter/ImporterFilePreview/ImporterFilePreview.tsx | Replaced useEffect-based data handling with useLoadData hooks and updated table data conversion, integrating new API fields. |
desktop/core/src/desktop/js/apps/newimporter/ImporterFilePreview/ImporterFilePreview.test.tsx | Revised tests to match the new API response structure and updated type definitions. |
Comments suppressed due to low confidence (3)
desktop/core/src/desktop/js/apps/newimporter/ImporterFilePreview/SourceConfiguration/SourceConfiguration.test.tsx:119
- [nitpick] Double-check the expected number of Select components for non-EXCEL file types; the discrepancy in counts between EXCEL and non-EXCEL tests could indicate an unintended UI change.
expect(selectElement).toHaveLength(5);
desktop/core/src/desktop/js/apps/newimporter/utils/utils.ts:35
- Ensure that converting column names to camelCase is compatible with all consumers of the table data, as this key transformation may affect downstream matching.
dataIndex: toCamelCase(item.name),
desktop/core/src/desktop/js/apps/newimporter/ImporterFilePreview/ImporterFilePreview.tsx:138
- [nitpick] Confirm that the structure of previewData returned by the API fully conforms to the expected format for convertToDataSource, ensuring that all required keys are present and correctly mapped.
const tableData = convertToDataSource(previewData?.previewData ?? {});
What changes were proposed in this pull request?
How was this patch tested?
Please review Hue Contributing Guide before opening a pull request.