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

No need to show common values if everything is null #547

Closed simonw closed 1 year ago

simonw commented 1 year ago

Noticed this:

% sqlite-utils analyze-tables content.db repos -c delete_branch_on_merge --common-limit 20 --no-least
repos.delete_branch_on_merge: (1/1)

  Total rows: 158
  Null rows: 158
  Blank rows: 0

  Distinct values: 0

  Most common:
    158: None

The 158: None there is duplicate information considering we already know there are 158/158 null rows.

simonw commented 1 year ago

This will be a cosmetic change to the CLI output only - the options to save data to the database and the Python API function will continue to return [(None, 158)].

I can add an optimization though to avoid running the SQL count query if we know that it's all null.