lancedb
lancedb copied to clipboard
bug(python): table.merge_insert does not accept a list of columns
LanceDB version
0.6.13
What happened?
When using merge_insert with multiple columns, then there is an error:
table.merge_insert(["a", "b"])
.when_matched_update_all()
.when_not_matched_insert_all()
.execute(insert_items)
Error:
File "/home/user/.cache/pypoetry/virtualenvs/p-MOM2VVIT-py3.10/lib/python3.10/site-packages/lancedb/table.py", line 485, in merge_insert
on = [on] if isinstance(on, str) else list(on.iter())
AttributeError: 'list' object has no attribute 'iter'
I think thatt line should be ... else list(iter(on))
This issue exists both in the sync and async table.
Are there known steps to reproduce?
No response
For now, a workaround is:
merge_builder = LanceMergeInsertBuilder(table, on=["a", "b"])
(merge_builder
.when_matched_update_all()
.when_not_matched_insert_all()
.execute(insert_items))
Thanks for reporting the issue! It is supported with the latest lancedb.
Are you sure? @QianZhu
https://github.com/lancedb/lancedb/blob/bcfc93cc889b1f3285f0aadb4921bf0625abeb43/python/python/lancedb/table.py#L833
This issue should be reopened