mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-09 18:14:09 +02:00
.transform(..., keep_table=name) parameter, closes #571
Also type hints for the transform_sql() method
This commit is contained in:
parent
2c12c01346
commit
61aaa69815
3 changed files with 42 additions and 13 deletions
|
|
@ -86,6 +86,16 @@ import pytest
|
|||
"ALTER TABLE [dogs_new_suffix] RENAME TO [dogs];",
|
||||
],
|
||||
),
|
||||
# Keeping the table
|
||||
(
|
||||
{"drop": ["age"], "keep_table": "kept_table"},
|
||||
[
|
||||
"CREATE TABLE [dogs_new_suffix] (\n [id] INTEGER PRIMARY KEY,\n [name] TEXT\n);",
|
||||
"INSERT INTO [dogs_new_suffix] ([id], [name])\n SELECT [id], [name] FROM [dogs];",
|
||||
"ALTER TABLE [dogs] RENAME TO [kept_table];",
|
||||
"ALTER TABLE [dogs_new_suffix] RENAME TO [dogs];",
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.parametrize("use_pragma_foreign_keys", [False, True])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue