mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 01:14:31 +02:00
Documentation for .transform(column_order=), closes #175
This commit is contained in:
parent
022cdd97a9
commit
725f206949
1 changed files with 7 additions and 0 deletions
|
|
@ -988,6 +988,13 @@ The ``defaults=`` parameter can be used to set or change the defaults for differ
|
|||
# Now remove the default from that column:
|
||||
table.transform(defaults={"age": None})
|
||||
|
||||
The ``column_order=`` parameter can be used to change the order of the columns. If you pass the names of a subset of the columns those will go first and columns you omitted will appear in their existing order after them.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# Change column order
|
||||
table.transform(column_order=("name", "age", "id")
|
||||
|
||||
You can use ``.transform()`` to remove foreign key constraints from a table. You will need to know the name of the column, the name of the table it points to and the name of the column it references on that other table.
|
||||
|
||||
This example drops two foreign keys - the one from ``places.country`` to ``country.id`` and the one from ``places.continent`` to ``continent.id``:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue