mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 09:24:31 +02:00
Also made it so .duplicate() raises new NoTable exception rather than raising an AssertionError if the source table does not exist.
This commit is contained in:
parent
da030d49fd
commit
c710ade644
7 changed files with 80 additions and 3 deletions
|
|
@ -1176,6 +1176,20 @@ reset-counts
|
|||
-h, --help Show this message and exit.
|
||||
|
||||
|
||||
duplicate
|
||||
=========
|
||||
|
||||
::
|
||||
|
||||
Usage: sqlite-utils duplicate [OPTIONS] PATH TABLE NEW_TABLE
|
||||
|
||||
Create a duplicate of this table, copying across the schema and all row data.
|
||||
|
||||
Options:
|
||||
--load-extension TEXT SQLite extensions to load
|
||||
-h, --help Show this message and exit.
|
||||
|
||||
|
||||
drop-table
|
||||
==========
|
||||
|
||||
|
|
|
|||
|
|
@ -1476,6 +1476,15 @@ You can specify foreign key relationships between the tables you are creating us
|
|||
|
||||
If a table with the same name already exists, you will get an error. You can choose to silently ignore this error with ``--ignore``, or you can replace the existing table with a new, empty table using ``--replace``.
|
||||
|
||||
.. _cli_duplicate_table:
|
||||
|
||||
Duplicating tables
|
||||
==================
|
||||
|
||||
The ``duplicate`` command duplicates a table - creating a new table with the same schema and a copy of all of the rows::
|
||||
|
||||
$ sqlite-utils duplicate books.db authors authors_copy
|
||||
|
||||
.. _cli_drop_table:
|
||||
|
||||
Dropping tables
|
||||
|
|
|
|||
|
|
@ -691,6 +691,8 @@ The ``table.duplicate()`` method creates a copy of the table, copying both the t
|
|||
|
||||
The new ``authors_copy`` table will now contain a duplicate copy of the data from ``authors``.
|
||||
|
||||
This method raises ``sqlite_utils.db.NoTable`` if the table does not exist.
|
||||
|
||||
.. _python_api_bulk_inserts:
|
||||
|
||||
Bulk inserts
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue