Support lists in .extract_expand()

This commit is contained in:
phaer 2021-09-19 09:46:56 +02:00
commit d1d780379c

View file

@ -1164,6 +1164,10 @@ class Table(Queryable):
if isinstance(expanded, dict):
new_pk = self.db[table].insert(expanded, pk="id", replace=True).last_pk
self.update(row_pk, {fk_column: new_pk})
elif isinstance(expanded, list):
for new_row in expanded:
new_pk = self.db[table].insert(new_row, pk="id", replace=True).last_pk
self.update(row_pk, {fk_column: new_pk})
# Can drop the original column now
self.transform(drop=[column])
# And add that foreign key