lancedb icon indicating copy to clipboard operation
lancedb copied to clipboard

bug(python): table.merge_insert does not accept a list of columns

Open lukebuehler opened this issue 1 year ago • 1 comments

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

lukebuehler avatar May 14 '24 09:05 lukebuehler

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))

lukebuehler avatar May 14 '24 09:05 lukebuehler

Thanks for reporting the issue! It is supported with the latest lancedb.

QianZhu avatar Nov 14 '24 23:11 QianZhu

Are you sure? @QianZhu

https://github.com/lancedb/lancedb/blob/bcfc93cc889b1f3285f0aadb4921bf0625abeb43/python/python/lancedb/table.py#L833

This issue should be reopened

dantetemplar avatar Jan 22 '25 21:01 dantetemplar