mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-08-01 15:04:11 +02:00
duplicate --ignore option, refs #450
This commit is contained in:
parent
5fa823f03f
commit
b9a89a0f2c
3 changed files with 12 additions and 2 deletions
|
|
@ -1501,8 +1501,9 @@ def create_table(
|
|||
)
|
||||
@click.argument("table")
|
||||
@click.argument("new_table")
|
||||
@click.option("--ignore", is_flag=True, help="If table does not exist, do nothing")
|
||||
@load_extension_option
|
||||
def duplicate(path, table, new_table, load_extension):
|
||||
def duplicate(path, table, new_table, ignore, load_extension):
|
||||
"""
|
||||
Create a duplicate of this table, copying across the schema and all row data.
|
||||
"""
|
||||
|
|
@ -1511,7 +1512,8 @@ def duplicate(path, table, new_table, load_extension):
|
|||
try:
|
||||
db[table].duplicate(new_table)
|
||||
except NoTable:
|
||||
raise click.ClickException('Table "{}" does not exist'.format(table))
|
||||
if not ignore:
|
||||
raise click.ClickException('Table "{}" does not exist'.format(table))
|
||||
|
||||
|
||||
@cli.command(name="drop-table")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue