mirror of
https://github.com/lancedb/lancedb.git
synced 2026-08-18 12:08:35 +00:00
fix(python): normalize merge insert column lists
This commit is contained in:
@@ -1346,7 +1346,7 @@ class Table(ABC):
|
||||
2 3 y
|
||||
3 4 z
|
||||
""" # noqa: E501
|
||||
on = [on] if isinstance(on, str) else list(iter(on))
|
||||
on = [on] if isinstance(on, str) else list(on)
|
||||
|
||||
return LanceMergeInsertBuilder(self, on)
|
||||
|
||||
@@ -5236,7 +5236,7 @@ class AsyncTable:
|
||||
2 3 y
|
||||
3 4 z
|
||||
""" # noqa: E501
|
||||
on = [on] if isinstance(on, str) else list(iter(on))
|
||||
on = [on] if isinstance(on, str) else list(on)
|
||||
|
||||
return LanceMergeInsertBuilder(self, on)
|
||||
|
||||
|
||||
@@ -2265,6 +2265,31 @@ def test_update_types(mem_db: DBConnection):
|
||||
assert actual == expected
|
||||
|
||||
|
||||
def test_merge_insert_accepts_column_list(mem_db: DBConnection):
|
||||
table = mem_db.create_table(
|
||||
"my_table",
|
||||
data=pa.table({"a": [1], "b": [2]}),
|
||||
)
|
||||
|
||||
builder = table.merge_insert(["a", "b"])
|
||||
|
||||
assert builder._on == ["a", "b"]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_merge_insert_accepts_column_list_async(
|
||||
mem_db_async: AsyncConnection,
|
||||
):
|
||||
table = await mem_db_async.create_table(
|
||||
"my_table",
|
||||
data=pa.table({"a": [1], "b": [2]}),
|
||||
)
|
||||
|
||||
builder = table.merge_insert(["a", "b"])
|
||||
|
||||
assert builder._on == ["a", "b"]
|
||||
|
||||
|
||||
def test_merge_insert(mem_db: DBConnection):
|
||||
table = mem_db.create_table(
|
||||
"my_table",
|
||||
|
||||
Reference in New Issue
Block a user