sqlite-utils/sqlite_utils
Simon Willison 1c1991b447 New options for analyze-tables - refs #544
This change adds three new options and modifies the `analyze_tables` function and `analyze_column` method in the `cli.py` and `db.py` modules respectively. The new options are `common_limit`, `no_most`, and `no_least`.

The `common_limit` option specifies how many common values should be returned by `analyze_column` method, by default it's set to 10. The `no_most` and `no_least` options, when set to True, skip returning the most and least common values, respectively.

The `analyze_tables` function was modified to pass the new options to the `_analyze` method, and the `analyze_column` method in the `db.py` module was modified to use the newly added options. Now, when `analyze_column` is called, it checks if `most_common` or `least_common` options are set to True before running the corresponding query. If the `num_distinct` value is less than or equal to `common_limit`, it doesn't run the least common query. The results from the most and least common queries are sorted before being returned.
2023-05-21 07:03:23 -07:00
..
__init__.py Docs for suggest_column_types, closes #81 2020-02-01 13:55:13 -08:00
__main__.py Support 'python -m sqlite_utils', closes #368 2022-01-08 18:33:22 -08:00
cli.py New options for analyze-tables - refs #544 2023-05-21 07:03:23 -07:00
db.py New options for analyze-tables - refs #544 2023-05-21 07:03:23 -07:00
py.typed py.typed file so mypy picks up the types, closes #331 2021-11-14 15:21:04 -08:00
recipes.py errors=r.SET_NULL/r.IGNORE options for parsedate/parsedatetime, closes #416 2022-03-20 21:01:35 -07:00
utils.py Better error message if rows_from_file called with StringIO, closes #520 2023-05-08 15:08:02 -07:00