mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 01:14:31 +02:00
.transform() now preserves rowid values
* .transform() now preserves rowid values, refs #592 * Test transform rowids against different table types, closes #592
This commit is contained in:
parent
5d123f031f
commit
1c6ea54338
2 changed files with 49 additions and 13 deletions
|
|
@ -1917,6 +1917,10 @@ class Table(Queryable):
|
|||
for from_, to_ in copy_from_to.items():
|
||||
old_cols.append(from_)
|
||||
new_cols.append(to_)
|
||||
# Ensure rowid is copied too
|
||||
if "rowid" not in new_cols:
|
||||
new_cols.insert(0, "rowid")
|
||||
old_cols.insert(0, "rowid")
|
||||
copy_sql = "INSERT INTO [{new_table}] ({new_cols})\n SELECT {old_cols} FROM [{old_table}];".format(
|
||||
new_table=new_table_name,
|
||||
old_table=self.name,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue