diff --git a/docs/cli.rst b/docs/cli.rst index 677f4b1..68ca429 100644 --- a/docs/cli.rst +++ b/docs/cli.rst @@ -298,14 +298,14 @@ To inspect the ``tags`` table in the ``github.db`` database, run the following:: Distinct values: 14 Most common: - 107914493: 88 - 140912432: 75 - 206156866: 27 + 88: 107914493 + 75: 140912432 + 27: 206156866 Least common: - 209590345: 1 - 206649770: 2 - 303218369: 2 + 1: 209590345 + 2: 206649770 + 2: 303218369 tags.name: (2/3) @@ -316,14 +316,14 @@ To inspect the ``tags`` table in the ``github.db`` database, run the following:: Distinct values: 175 Most common: - 0.2: 10 - 0.1: 9 - 0.3: 7 + 10: 0.2 + 9: 0.1 + 7: 0.3 Least common: - 0.1.1: 1 - 0.11.1: 1 - 0.1a2: 1 + 1: 0.1.1 + 1: 0.11.1 + 1: 0.1a2 tags.sha: (3/3) diff --git a/sqlite_utils/cli.py b/sqlite_utils/cli.py index 81454dc..6312327 100644 --- a/sqlite_utils/cli.py +++ b/sqlite_utils/cli.py @@ -1394,7 +1394,7 @@ def analyze_tables( # Now we now how many we need to do for i, (table, column) in enumerate(todo): column_details = db[table].analyze_column( - column, total_rows=table_counts[table] + column, total_rows=table_counts[table], value_truncate=80 ) if save: db["_analyze_tables_"].insert( @@ -1438,7 +1438,7 @@ def _render_common(title, values): return "" lines = [title] for value, count in values: - lines.append(" {}: {}".format(value, count)) + lines.append(" {}: {}".format(count, value)) return "\n".join(lines) diff --git a/sqlite_utils/db.py b/sqlite_utils/db.py index 9f2653c..d8bd221 100644 --- a/sqlite_utils/db.py +++ b/sqlite_utils/db.py @@ -1944,7 +1944,7 @@ class Table(Queryable): return self def analyze_column( - self, column, common_limit=10, value_truncate=80, total_rows=None + self, column, common_limit=10, value_truncate=None, total_rows=None ): db = self.db table = self.name diff --git a/tests/test_analyze_tables.py b/tests/test_analyze_tables.py index 17ec966..7a104e7 100644 --- a/tests/test_analyze_tables.py +++ b/tests/test_analyze_tables.py @@ -108,10 +108,10 @@ stuff.owner: (2/3) Distinct values: 4 Most common: - Joan: 3 - Terryterryterry: 2 - Kumar: 2 - Anne: 1 + 3: Joan + 2: Terryterryterry + 2: Kumar + 1: Anne stuff.size: (3/3) @@ -123,7 +123,7 @@ stuff.size: (3/3) Most common: 5: 5 - 4: 3""" + 3: 4""" ).strip() )