mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-19 15:04:10 +02:00
-c / --column option
This commit is contained in:
parent
61461b9881
commit
ef219d6b4d
1 changed files with 4 additions and 1 deletions
|
|
@ -1361,11 +1361,13 @@ def insert_files(
|
||||||
required=True,
|
required=True,
|
||||||
)
|
)
|
||||||
@click.argument("tables", nargs=-1)
|
@click.argument("tables", nargs=-1)
|
||||||
|
@click.option("-c", "--column", "columns", type=str, multiple=True, help="Specific columns to analyze")
|
||||||
@click.option("--save", is_flag=True, help="Save results to _analyze_tables table")
|
@click.option("--save", is_flag=True, help="Save results to _analyze_tables table")
|
||||||
@load_extension_option
|
@load_extension_option
|
||||||
def analyze_tables(
|
def analyze_tables(
|
||||||
path,
|
path,
|
||||||
tables,
|
tables,
|
||||||
|
columns,
|
||||||
save,
|
save,
|
||||||
load_extension,
|
load_extension,
|
||||||
):
|
):
|
||||||
|
|
@ -1379,7 +1381,8 @@ def analyze_tables(
|
||||||
for table in tables:
|
for table in tables:
|
||||||
table_counts[table] = db[table].count
|
table_counts[table] = db[table].count
|
||||||
for column in db[table].columns:
|
for column in db[table].columns:
|
||||||
todo.append((table, column.name))
|
if (not columns or column.name in columns):
|
||||||
|
todo.append((table, column.name))
|
||||||
# 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, total_rows=table_counts[table])
|
column_details = db[table].analyze_column(column, total_rows=table_counts[table])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue