sqlite-utils create-database command, closes #348

This commit is contained in:
Simon Willison 2022-01-09 12:33:16 -08:00
commit 1d64cd2e5b
3 changed files with 48 additions and 0 deletions

View file

@ -1052,6 +1052,23 @@ def upsert(
raise click.ClickException(UNICODE_ERROR.format(ex))
@cli.command(name="create-database")
@click.argument(
"path",
type=click.Path(file_okay=True, dir_okay=False, allow_dash=False),
required=True,
)
@click.option(
"--enable-wal", is_flag=True, help="Enable WAL mode on the created database"
)
def create_table(path, enable_wal):
"Create a new empty database file."
db = sqlite_utils.Database(path)
if enable_wal:
db.enable_wal()
db.vacuum()
@cli.command(name="create-table")
@click.argument(
"path",