sqlite-utils/sqlite_utils
Rami Abdelrazzaq 2b0cc04c8d
Fix issue #702: Handle CSV with only header row in --detect-types (#707)
When inserting a CSV file that contains only a header row (no data rows),
the --detect-types option would crash with an AssertionError because it
tried to transform a table that didn't exist.

This fix adds a check to ensure the table exists before attempting to
apply type transformations. The fix is applied in two places:
1. insert_upsert_implementation() for the insert command
2. memory() command for CSV/TSV files

Added test case: test_insert_csv_headers_only

Co-authored-by: Test User <test@example.com>
2026-06-21 15:57:06 -07:00
..
__init__.py New migrations system, ported from sqlite-migrate (#754) 2026-06-21 09:40:21 -07:00
__main__.py Support 'python -m sqlite_utils', closes #368 2022-01-08 18:33:22 -08:00
cli.py Fix issue #702: Handle CSV with only header row in --detect-types (#707) 2026-06-21 15:57:06 -07:00
db.py Fix for detect_fts failing on [], refs #694 2026-06-21 15:54:19 -07:00
hookspecs.py More type annotations (#697) 2025-12-16 22:11:47 -08:00
migrations.py New migrations system, ported from sqlite-migrate (#754) 2026-06-21 09:40:21 -07:00
plugins.py More type annotations (#697) 2025-12-16 22:11:47 -08:00
py.typed py.typed file so mypy picks up the types, closes #331 2021-11-14 15:21:04 -08:00
recipes.py More type annotations (#697) 2025-12-16 22:11:47 -08:00
utils.py Test against Python 3.15-dev, bump ty and Black (#738) 2026-05-17 16:52:48 -07:00