Skip to content

feat(mysql): Excel sheet/header/NULL options (#2602) - #2654

Open
Aias00 wants to merge 5 commits into
OtterMind:mainfrom
Aias00:feature/mysql-excel-options-2602
Open

feat(mysql): Excel sheet/header/NULL options (#2602)#2654
Aias00 wants to merge 5 commits into
OtterMind:mainfrom
Aias00:feature/mysql-excel-options-2602

Conversation

@Aias00

@Aias00 Aias00 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

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).
  • Typed previews: string / number / date / boolean / cached-formula (marked [formula]); formulas are never evaluated.
  • Damaged workbook, missing sheet, or no visible sheet fail before any write.
  • Mapping modal: Excel options bar (sheet, start row, header row, empty-field) with immediate bounded preview refresh and typed sample rendering.
  • Also fixes MYSQL-IMPORT-002's missing service wiring (csvOptions parse path + formula-injection guard), so the CSV feature compiles standalone.
  • i18n ×5 + MYSQL-IMPORT-003 fixtures (multi-sheet xlsx with typed cells + cached formula, no-header xlsx, typed xls).

Test plan

  • Run MYSQL-IMPORT-003 README verification (sheet selection, typed previews incl. cached formula, start/header rows, empty-cell rule, no-header, xls, damaged workbook, hidden sheet)

Aias00 added 3 commits August 7, 2026 01:38
- 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).
@Aias00
Aias00 requested a review from openai0229 as a code owner August 7, 2026 09:00
Copilot AI lite review requested due to automatic review settings August 7, 2026 09:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@openai0229

openai0229 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Follow-up review after the latest main integration: changes are still requested before merge.

The cumulative implementation still reads the whole file, accepts an unchecked client path, binds omitted DEFAULT columns, never increments skippedCount, and calls executeBatch() per row outside the TaskService workflow. Excel-specific defects also remain: numeric cells use new BigDecimal(double), which can alter exact values; header selection and data-row offsets are not modeled robustly; and an explicitly selected hidden sheet is still accepted. Please fix the shared import path, add large-file and exact-value fixtures, and rerun CI.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

[MYSQL-IMPORT-003] Support Excel sheet, header, and empty-cell options

3 participants