mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-25 02:14:31 +02:00
sqlite-utils schema now takes optional tables, closes #299
This commit is contained in:
parent
8286a66413
commit
ab8d4aad0c
3 changed files with 55 additions and 17 deletions
|
|
@ -1550,15 +1550,21 @@ def indexes(
|
|||
type=click.Path(file_okay=True, dir_okay=False, allow_dash=False),
|
||||
required=True,
|
||||
)
|
||||
@click.argument("tables", nargs=-1, required=False)
|
||||
@load_extension_option
|
||||
def schema(
|
||||
path,
|
||||
tables,
|
||||
load_extension,
|
||||
):
|
||||
"Show full schema for this database"
|
||||
"Show full schema for this database or for specified tables"
|
||||
db = sqlite_utils.Database(path)
|
||||
_load_extensions(db, load_extension)
|
||||
click.echo(db.schema)
|
||||
if tables:
|
||||
for table in tables:
|
||||
click.echo(db[table].schema)
|
||||
else:
|
||||
click.echo(db.schema)
|
||||
|
||||
|
||||
@cli.command()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue