diff --git a/sqlite_utils/cli.py b/sqlite_utils/cli.py index 6cd23f7..7e653e6 100644 --- a/sqlite_utils/cli.py +++ b/sqlite_utils/cli.py @@ -1361,11 +1361,13 @@ def insert_files( required=True, ) @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") @load_extension_option def analyze_tables( path, tables, + columns, save, load_extension, ): @@ -1379,7 +1381,8 @@ def analyze_tables( for table in tables: table_counts[table] = db[table].count 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 for i, (table, column) in enumerate(todo): column_details = db[table].analyze_column(column, total_rows=table_counts[table])