Skip to content

Commit

Permalink
sqlite-utils table_names blah.db is now tables blah.db
Browse files Browse the repository at this point in the history
Travis tests were failing because on OS X the command was this:

   sqlite-utils table_names blah.db

But in Travis CI the command was this:

   sqlite-utils table-names blah.db

Renaming it to tables fixes this inconsistency.
  • Loading branch information
simonw committed Jan 25, 2019
1 parent 42b2b4b commit 9501ba4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

This release implements the ``sqlite-utils`` command-line tool with a number of useful subcommands.

- ``sqlite-utils table_names demo.db`` lists the tables in the database
- ``sqlite-utils table_names demo.db --fts4`` shows just the FTS4 tables
- ``sqlite-utils table_names demo.db --fts5`` shows just the FTS5 tables
- ``sqlite-utils tables demo.db`` lists the tables in the database
- ``sqlite-utils tables demo.db --fts4`` shows just the FTS4 tables
- ``sqlite-utils tables demo.db --fts5`` shows just the FTS5 tables
- ``sqlite-utils vacuum demo.db`` runs VACUUM against the database
- ``sqlite-utils optimize demo.db`` runs OPTIMIZE against all FTS tables, then VACUUM
- ``sqlite-utils optimize demo.db --no-vacuum`` runs OPTIMIZE but skips VACUUM
Expand Down
6 changes: 3 additions & 3 deletions docs/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ The ``sqlite-utils`` command-line tool can be used to manipulate SQLite database
Listing tables
==============

You can list the names of tables in a database using the ``table_names`` subcommand::
You can list the names of tables in a database using the ``tables`` subcommand::

$ sqlite-utils table_names mydb.db
$ sqlite-utils tables mydb.db
dogs
cats
chickens

If you just want to see the FTS4 tables, you can use ``--fts4`` (or ``--fts5`` for FTS5 tables)::

$ sqlite-utils table_names --fts4 docs.db
$ sqlite-utils tables --fts4 docs.db
docs_fts

.. _cli_inserting_data:
Expand Down
2 changes: 1 addition & 1 deletion sqlite_utils/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def cli():
@click.option(
"--fts5", help="Just show FTS5 enabled tables", default=False, is_flag=True
)
def table_names(path, fts4, fts5):
def tables(path, fts4, fts5):
"""List the tables in the database"""
db = sqlite_utils.Database(path)
for name in db.table_names(fts4=fts4, fts5=fts5):
Expand Down
12 changes: 6 additions & 6 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ def db_path(tmpdir):
return path


def test_table_names(db_path):
result = CliRunner().invoke(cli.cli, ["table_names", db_path])
def test_tables(db_path):
result = CliRunner().invoke(cli.cli, ["tables", db_path])
assert "Gosh\nGosh2" == result.output.strip()


def test_table_names_fts4(db_path):
def test_tables_fts4(db_path):
Database(db_path)["Gosh"].enable_fts(["c2"], fts_version="FTS4")
result = CliRunner().invoke(cli.cli, ["table_names", "--fts4", db_path])
result = CliRunner().invoke(cli.cli, ["tables", "--fts4", db_path])
assert "Gosh_fts" == result.output.strip()


def test_table_names_fts5(db_path):
def test_tables_fts5(db_path):
Database(db_path)["Gosh"].enable_fts(["c2"], fts_version="FTS5")
result = CliRunner().invoke(cli.cli, ["table_names", "--fts5", db_path])
result = CliRunner().invoke(cli.cli, ["tables", "--fts5", db_path])
assert "Gosh_fts" == result.output.strip()


Expand Down

0 comments on commit 9501ba4

Please sign in to comment.