mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-24 01:44:31 +02:00
sqlite-utils analyze command, refs #379
This commit is contained in:
parent
389cbd5792
commit
e0ef9288fe
4 changed files with 76 additions and 1 deletions
|
|
@ -304,6 +304,26 @@ def rebuild_fts(path, tables, load_extension):
|
|||
db[table].rebuild_fts()
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.argument(
|
||||
"path",
|
||||
type=click.Path(exists=True, file_okay=True, dir_okay=False, allow_dash=False),
|
||||
required=True,
|
||||
)
|
||||
@click.argument("names", nargs=-1)
|
||||
def analyze(path, names):
|
||||
"""Run ANALYZE against the whole database, or against specific named indexes and tables"""
|
||||
db = sqlite_utils.Database(path)
|
||||
try:
|
||||
if names:
|
||||
for name in names:
|
||||
db.analyze(name)
|
||||
else:
|
||||
db.analyze()
|
||||
except sqlite3.OperationalError as e:
|
||||
raise click.ClickException(e)
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.argument(
|
||||
"path",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue