simonw / sqlite-utils

Python CLI utility and library for manipulating SQLite databases
https://sqlite-utils.datasette.io
Apache License 2.0
1.62k stars 109 forks source link

analyze-tables should validate provide --column names #548

Closed simonw closed 1 year ago

simonw commented 1 year ago

Noticed this while testing:

If you pass a non-existent column to -c/--column you don't get an error message.

simonw commented 1 year ago

Oh, I see why that is now:

https://github.com/simonw/sqlite-utils/blob/6027f3ea6939a399aeef2578fca17efec0e539df/sqlite_utils/cli.py#L2670-L2679

This is because of the following command:

sqlite-utils analyze-tables table1 table2 --column x

Since you can pass multiple tables AND multiple columns, the tool currently assumes that the column(s) you specify may be available on a subset of the provided tables.

I'm going to change this so if the column is not on ANY of those tables you get an error.