Skip to content

Feature: 'did you mean' suggestions for unknown column/table errors #221

Description

@vmvarela

Context

SQLite errors on typos are terse: no such column: emial. The tool knows the real column list (already exposed via getTableColumns / PRAGMA table_info), so a Levenshtein suggestion is cheap and saves a round trip to --columns. #197 already contemplates the same mechanism for parameter names.

Proposed behavior

$ sql-pipe data.csv 'SELECT emial FROM t'
error: no such column: emial
hint:  did you mean 'email'?
  • On SQLite no such column: X / no such table: X errors, look up known names and suggest the closest match within edit distance ≤ 2 (scaled for short names).
  • Print hint to stderr after the error; exit code unchanged.

Scope (v1)

Excluded (YAGNI)

  • Suggesting SQL keywords or functions
  • Multiple suggestions (one best match is enough)
  • Fuzzy auto-correction (hint only, never rewrite the query)

Acceptance criteria

  • Typo column produces a 'did you mean' hint on stderr
  • Typo table name likewise
  • No hint when nothing is within the distance threshold
  • Error path and exit code otherwise unchanged
  • Unit test for the distance/suggestion helper

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:lowNice to have, do when possiblesize:sSmall — 1 to 4 hourstype:featureNew functionality

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions