-
-
Notifications
You must be signed in to change notification settings - Fork 124
Description
I exported an empty table to csv, so that the csv file contains only the header row. When trying to create an SQLite DB file from that, using
sqlite-utils insert "$dbfile" "$table" "$csvfile" --csv --detect-types
I run into this error:
File "/root/.local/pipx/venvs/sqlite-utils/lib/python3.11/site-packages/sqlite_utils/cli.py", line 1244, in insert
insert_upsert_implementation(
File "/root/.local/pipx/venvs/sqlite-utils/lib/python3.11/site-packages/sqlite_utils/cli.py", line 1128, in insert_upsert_implementation
db[table].transform(types=tracker.types)
File "/root/.local/pipx/venvs/sqlite-utils/lib/python3.11/site-packages/sqlite_utils/db.py", line 1780, in transform
assert self.exists(), "Cannot transform a table that doesn't exist yet"
AssertionError: Cannot transform a table that doesn't exist yet
If I run it without --detect-types, then the issue naturally does not occur.
If --detect-types is going to be the default in the future, then I would suggest fixing this, for example by making the following change in cli.py on line 1179:
if tracker is not None and db.table(table).exists():