feat(mysql): Excel sheet/header/NULL options (#2602) - #2654
Open
Aias00 wants to merge 5 commits into
Open
Conversation
- Bounded preview endpoint (CSV/XLS/XLSX via the same EasyExcel reader as execution): source fields with sample values, target columns with type/ nullable/default, and a suggested mapping by exact name match. - Mapping-driven import: remap source fields to target columns, skip source fields, fill unmapped target columns with DEFAULT or explicit NULL; NOT NULL columns without a default block execution before any write when unmapped. - Row-level error reporting (source row, target column, message) with per-row continue-on-error; type coercion for numeric/date columns. - Import modal gains a mapping step after file selection; i18n in all five locales and MYSQL-IMPORT-001 fixtures (reordered/extra columns, strict table, CSV samples).
- Configurable CSV parser (CsvParser) shared by preview and execution: encodings (UTF-8/GB18030/ISO-8859-1, strict decoding), single-char delimiter (comma/semicolon/tab/pipe), quote and escape chars, header toggle, automatic CRLF/LF/CR line-ending detection, embedded newlines and quoted delimiters. - Explicit empty-field rule: empty fields become SQL NULL or empty string; unclosed quotes and invalid encodings are rejected with the source line before any write. - Spreadsheet formula injection guard (= + - @ prefixed values are quoted on import). - Mapping modal gains a CSV options bar that refreshes the bounded preview immediately on change; i18n in all five locales and MYSQL-IMPORT-002 byte-accurate fixtures (3 encodings, 4 delimiters, CRLF, no header, bad quote).
- ExcelParser (POI) shared by preview and execution: visible-sheet list, single-sheet selection, configurable start row and header row, and an explicit empty-cell rule (empty string vs SQL NULL). - Typed cell previews: strings, numbers (untrimmed big values), dates, booleans, and cached formula results marked [formula] — formulas are never evaluated. - Damaged workbooks, missing sheets, and no-visible-sheet fail before any database write. - Also completes the CSV-options wiring in DbImportPreviewServiceImpl that was missing from MYSQL-IMPORT-002 (parseRows/ParseOutcome with csvOptions and the formula-injection guard), so both features compile and run together. - Mapping modal gains an Excel options bar (sheet/start row/header row/ empty-field) with immediate bounded-preview refresh; typed preview rendering; i18n in all five locales and MYSQL-IMPORT-003 fixtures (multi-sheet xlsx with types and cached formula, no-header xlsx, typed xls).
This was referenced Aug 19, 2026
Contributor
|
Follow-up review after the latest The cumulative implementation still reads the whole file, accepts an unchecked client path, binds omitted DEFAULT columns, never increments |
Constraint: preserve workbook-specific validation/messages while adopting main's task submission and artifact handling Rejected: dropping the PR's preview import branch | would remove the Excel option surface under review Confidence: high Scope-risk: narrow Tested: NODE_PATH=/Users/aias/Work/github/Chat2DB/chat2db-community-client/node_modules node ./scripts/validate-i18n.cjs --write-source-hashes; git diff --cached --check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2602
Summary
ExcelParser(Apache POI) shared by preview and execution: visible-sheet listing, single-sheet selection, configurable start row / header row, empty-cell rule (empty string vs SQL NULL).[formula]); formulas are never evaluated.Test plan