mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-27 20:34:12 +02:00
Swap count and value in analyze output
This commit is contained in:
parent
f65fe8ad5c
commit
1491467444
4 changed files with 20 additions and 20 deletions
24
docs/cli.rst
24
docs/cli.rst
|
|
@ -298,14 +298,14 @@ To inspect the ``tags`` table in the ``github.db`` database, run the following::
|
||||||
Distinct values: 14
|
Distinct values: 14
|
||||||
|
|
||||||
Most common:
|
Most common:
|
||||||
107914493: 88
|
88: 107914493
|
||||||
140912432: 75
|
75: 140912432
|
||||||
206156866: 27
|
27: 206156866
|
||||||
|
|
||||||
Least common:
|
Least common:
|
||||||
209590345: 1
|
1: 209590345
|
||||||
206649770: 2
|
2: 206649770
|
||||||
303218369: 2
|
2: 303218369
|
||||||
|
|
||||||
tags.name: (2/3)
|
tags.name: (2/3)
|
||||||
|
|
||||||
|
|
@ -316,14 +316,14 @@ To inspect the ``tags`` table in the ``github.db`` database, run the following::
|
||||||
Distinct values: 175
|
Distinct values: 175
|
||||||
|
|
||||||
Most common:
|
Most common:
|
||||||
0.2: 10
|
10: 0.2
|
||||||
0.1: 9
|
9: 0.1
|
||||||
0.3: 7
|
7: 0.3
|
||||||
|
|
||||||
Least common:
|
Least common:
|
||||||
0.1.1: 1
|
1: 0.1.1
|
||||||
0.11.1: 1
|
1: 0.11.1
|
||||||
0.1a2: 1
|
1: 0.1a2
|
||||||
|
|
||||||
tags.sha: (3/3)
|
tags.sha: (3/3)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1394,7 +1394,7 @@ def analyze_tables(
|
||||||
# Now we now how many we need to do
|
# Now we now how many we need to do
|
||||||
for i, (table, column) in enumerate(todo):
|
for i, (table, column) in enumerate(todo):
|
||||||
column_details = db[table].analyze_column(
|
column_details = db[table].analyze_column(
|
||||||
column, total_rows=table_counts[table]
|
column, total_rows=table_counts[table], value_truncate=80
|
||||||
)
|
)
|
||||||
if save:
|
if save:
|
||||||
db["_analyze_tables_"].insert(
|
db["_analyze_tables_"].insert(
|
||||||
|
|
@ -1438,7 +1438,7 @@ def _render_common(title, values):
|
||||||
return ""
|
return ""
|
||||||
lines = [title]
|
lines = [title]
|
||||||
for value, count in values:
|
for value, count in values:
|
||||||
lines.append(" {}: {}".format(value, count))
|
lines.append(" {}: {}".format(count, value))
|
||||||
return "\n".join(lines)
|
return "\n".join(lines)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1944,7 +1944,7 @@ class Table(Queryable):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def analyze_column(
|
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
|
db = self.db
|
||||||
table = self.name
|
table = self.name
|
||||||
|
|
|
||||||
|
|
@ -108,10 +108,10 @@ stuff.owner: (2/3)
|
||||||
Distinct values: 4
|
Distinct values: 4
|
||||||
|
|
||||||
Most common:
|
Most common:
|
||||||
Joan: 3
|
3: Joan
|
||||||
Terryterryterry: 2
|
2: Terryterryterry
|
||||||
Kumar: 2
|
2: Kumar
|
||||||
Anne: 1
|
1: Anne
|
||||||
|
|
||||||
stuff.size: (3/3)
|
stuff.size: (3/3)
|
||||||
|
|
||||||
|
|
@ -123,7 +123,7 @@ stuff.size: (3/3)
|
||||||
|
|
||||||
Most common:
|
Most common:
|
||||||
5: 5
|
5: 5
|
||||||
4: 3"""
|
3: 4"""
|
||||||
).strip()
|
).strip()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue