Compare commits

...

4 Commits

Author SHA1 Message Date
Xuanwo
16a7e29639 Format python
Signed-off-by: Xuanwo <github@xuanwo.io>
2025-07-10 19:11:02 +08:00
Xuanwo
0e7a218d62 docs: Add examples for where in when_matched_update_all
Signed-off-by: Xuanwo <github@xuanwo.io>
2025-07-10 19:08:45 +08:00
CyrusAttoun
167fccc427 fix: change 'return' to 'raise' for unimplemented remote table function (#2484)
just noticed that we're doing a 'return' instead of a 'raise' while
trying to get remote functionality working for my project. I went ahead
and implemented tests for both of the unimplemented functions (to_pandas
and to_arrow) while I was in there.

---------

Co-authored-by: Cyrus Attoun <jattoun1@gmail.com>
2025-07-09 14:27:08 -07:00
Lance Release
2bffbcefa5 Bump version: 0.21.1-beta.0 → 0.21.1-beta.1 2025-07-09 05:54:20 +00:00
23 changed files with 103 additions and 100 deletions

View File

@@ -1,5 +1,5 @@
[tool.bumpversion]
current_version = "0.21.1-beta.0"
current_version = "0.21.1-beta.1"
parse = """(?x)
(?P<major>0|[1-9]\\d*)\\.
(?P<minor>0|[1-9]\\d*)\\.

8
Cargo.lock generated
View File

@@ -4314,7 +4314,7 @@ dependencies = [
[[package]]
name = "lancedb"
version = "0.21.1-beta.0"
version = "0.21.1-beta.1"
dependencies = [
"arrow",
"arrow-array",
@@ -4401,7 +4401,7 @@ dependencies = [
[[package]]
name = "lancedb-node"
version = "0.21.1-beta.0"
version = "0.21.1-beta.1"
dependencies = [
"arrow-array",
"arrow-ipc",
@@ -4426,7 +4426,7 @@ dependencies = [
[[package]]
name = "lancedb-nodejs"
version = "0.21.1-beta.0"
version = "0.21.1-beta.1"
dependencies = [
"arrow-array",
"arrow-ipc",
@@ -4446,7 +4446,7 @@ dependencies = [
[[package]]
name = "lancedb-python"
version = "0.24.1-beta.0"
version = "0.24.1-beta.1"
dependencies = [
"arrow",
"env_logger",

View File

@@ -71,6 +71,45 @@ with merge insert, enable both `when_matched_update_all()` and
If a column is nullable, it can be omitted from input data and it will be
considered `null`. Columns can also be provided in any order.
### Conditional Updates
You can add a `where` clause to `when_matched_update_all()` to only update rows
that meet certain conditions. When using the `where` parameter, you must prefix
column names with either `source.` (for the new data) or `target.` (for the
existing data) to specify which table you're referencing.
=== "Python"
```python
# Only update rows where the target's status is 'active'
table.merge_insert("id")
.when_matched_update_all(where="target.status = 'active'")
.when_not_matched_insert_all()
.execute(new_data)
# Only update if the new price is higher than the existing price
table.merge_insert("product_id")
.when_matched_update_all(where="source.price > target.price")
.when_not_matched_insert_all()
.execute(new_data)
```
=== "Typescript"
```typescript
// Only update rows where the target's status is 'active'
await table.mergeInsert("id")
.whenMatchedUpdateAll({ where: "target.status = 'active'" })
.whenNotMatchedInsertAll()
.execute(newData);
// Only update if the new price is higher than the existing price
await table.mergeInsert("product_id")
.whenMatchedUpdateAll({ where: "source.price > target.price" })
.whenNotMatchedInsertAll()
.execute(newData);
```
## Insert-if-not-exists
To avoid inserting duplicate rows, you can use the insert-if-not-exists command.

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>com.lancedb</groupId>
<artifactId>lancedb-parent</artifactId>
<version>0.21.1-beta.0</version>
<version>0.21.1-beta.1</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@@ -6,7 +6,7 @@
<groupId>com.lancedb</groupId>
<artifactId>lancedb-parent</artifactId>
<version>0.21.1-beta.0</version>
<version>0.21.1-beta.1</version>
<packaging>pom</packaging>
<name>LanceDB Parent</name>

79
node/package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "vectordb",
"version": "0.21.1-beta.0",
"version": "0.21.1-beta.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "vectordb",
"version": "0.21.1-beta.0",
"version": "0.21.1-beta.1",
"cpu": [
"x64",
"arm64"
@@ -52,11 +52,11 @@
"uuid": "^9.0.0"
},
"optionalDependencies": {
"@lancedb/vectordb-darwin-arm64": "0.21.1-beta.0",
"@lancedb/vectordb-darwin-x64": "0.21.1-beta.0",
"@lancedb/vectordb-linux-arm64-gnu": "0.21.1-beta.0",
"@lancedb/vectordb-linux-x64-gnu": "0.21.1-beta.0",
"@lancedb/vectordb-win32-x64-msvc": "0.21.1-beta.0"
"@lancedb/vectordb-darwin-arm64": "0.21.1-beta.1",
"@lancedb/vectordb-darwin-x64": "0.21.1-beta.1",
"@lancedb/vectordb-linux-arm64-gnu": "0.21.1-beta.1",
"@lancedb/vectordb-linux-x64-gnu": "0.21.1-beta.1",
"@lancedb/vectordb-win32-x64-msvc": "0.21.1-beta.1"
},
"peerDependencies": {
"@apache-arrow/ts": "^14.0.2",
@@ -326,71 +326,6 @@
"@jridgewell/sourcemap-codec": "^1.4.10"
}
},
"node_modules/@lancedb/vectordb-darwin-arm64": {
"version": "0.21.1-beta.0",
"resolved": "https://registry.npmjs.org/@lancedb/vectordb-darwin-arm64/-/vectordb-darwin-arm64-0.21.1-beta.0.tgz",
"integrity": "sha512-easypFtN4rFFsSNumFLK/VEhD2BVp+jl6ysICGyutjD/UEiulVdhixBkK5miJOfu/1p67Rjit5C8u3acpX+k2g==",
"cpu": [
"arm64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@lancedb/vectordb-darwin-x64": {
"version": "0.21.1-beta.0",
"resolved": "https://registry.npmjs.org/@lancedb/vectordb-darwin-x64/-/vectordb-darwin-x64-0.21.1-beta.0.tgz",
"integrity": "sha512-ez//lKtXu7EWgZlUYgwBM2We4/ty8rOtkDMF3RlveWJAKn+zNX0UM3vTa9W7WbCcBn9Ycs3eQGrBvb0iYFIDgw==",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@lancedb/vectordb-linux-arm64-gnu": {
"version": "0.21.1-beta.0",
"resolved": "https://registry.npmjs.org/@lancedb/vectordb-linux-arm64-gnu/-/vectordb-linux-arm64-gnu-0.21.1-beta.0.tgz",
"integrity": "sha512-T+vfr3A/59V8JMB5vonUmFDE8Vcf7Qe+DhQMf6kUlQxx80TujMeTdkaOf9/zBAopN2T8Y2h+GNScjl/WomYOFg==",
"cpu": [
"arm64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@lancedb/vectordb-linux-x64-gnu": {
"version": "0.21.1-beta.0",
"resolved": "https://registry.npmjs.org/@lancedb/vectordb-linux-x64-gnu/-/vectordb-linux-x64-gnu-0.21.1-beta.0.tgz",
"integrity": "sha512-FpDd4g2+xGrU41gywx4KFPGOlpBZq3VrE+4BBiTrRW6IO5Kbs2Mmq7ufJuDLlLqPs6ZQ5/Wlbcq5PmdRSoeq8A==",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@lancedb/vectordb-win32-x64-msvc": {
"version": "0.21.1-beta.0",
"resolved": "https://registry.npmjs.org/@lancedb/vectordb-win32-x64-msvc/-/vectordb-win32-x64-msvc-0.21.1-beta.0.tgz",
"integrity": "sha512-SEKHecFpgODmrUsAE8pBLu8OMKnAx97Ap0FrH6AGGglJKAVirrrg9BKSPfmHMZCvyPSHzG5TUMxhtNm+Ibg5DQ==",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"win32"
]
},
"node_modules/@neon-rs/cli": {
"version": "0.0.160",
"resolved": "https://registry.npmjs.org/@neon-rs/cli/-/cli-0.0.160.tgz",

View File

@@ -1,6 +1,6 @@
{
"name": "vectordb",
"version": "0.21.1-beta.0",
"version": "0.21.1-beta.1",
"description": " Serverless, low-latency vector database for AI applications",
"private": false,
"main": "dist/index.js",
@@ -89,10 +89,10 @@
}
},
"optionalDependencies": {
"@lancedb/vectordb-darwin-x64": "0.21.1-beta.0",
"@lancedb/vectordb-darwin-arm64": "0.21.1-beta.0",
"@lancedb/vectordb-linux-x64-gnu": "0.21.1-beta.0",
"@lancedb/vectordb-linux-arm64-gnu": "0.21.1-beta.0",
"@lancedb/vectordb-win32-x64-msvc": "0.21.1-beta.0"
"@lancedb/vectordb-darwin-x64": "0.21.1-beta.1",
"@lancedb/vectordb-darwin-arm64": "0.21.1-beta.1",
"@lancedb/vectordb-linux-x64-gnu": "0.21.1-beta.1",
"@lancedb/vectordb-linux-arm64-gnu": "0.21.1-beta.1",
"@lancedb/vectordb-win32-x64-msvc": "0.21.1-beta.1"
}
}

View File

@@ -1,7 +1,7 @@
[package]
name = "lancedb-nodejs"
edition.workspace = true
version = "0.21.1-beta.0"
version = "0.21.1-beta.1"
license.workspace = true
description.workspace = true
repository.workspace = true

View File

@@ -1,6 +1,6 @@
{
"name": "@lancedb/lancedb-darwin-arm64",
"version": "0.21.1-beta.0",
"version": "0.21.1-beta.1",
"os": ["darwin"],
"cpu": ["arm64"],
"main": "lancedb.darwin-arm64.node",

View File

@@ -1,6 +1,6 @@
{
"name": "@lancedb/lancedb-darwin-x64",
"version": "0.21.1-beta.0",
"version": "0.21.1-beta.1",
"os": ["darwin"],
"cpu": ["x64"],
"main": "lancedb.darwin-x64.node",

View File

@@ -1,6 +1,6 @@
{
"name": "@lancedb/lancedb-linux-arm64-gnu",
"version": "0.21.1-beta.0",
"version": "0.21.1-beta.1",
"os": ["linux"],
"cpu": ["arm64"],
"main": "lancedb.linux-arm64-gnu.node",

View File

@@ -1,6 +1,6 @@
{
"name": "@lancedb/lancedb-linux-arm64-musl",
"version": "0.21.1-beta.0",
"version": "0.21.1-beta.1",
"os": ["linux"],
"cpu": ["arm64"],
"main": "lancedb.linux-arm64-musl.node",

View File

@@ -1,6 +1,6 @@
{
"name": "@lancedb/lancedb-linux-x64-gnu",
"version": "0.21.1-beta.0",
"version": "0.21.1-beta.1",
"os": ["linux"],
"cpu": ["x64"],
"main": "lancedb.linux-x64-gnu.node",

View File

@@ -1,6 +1,6 @@
{
"name": "@lancedb/lancedb-linux-x64-musl",
"version": "0.21.1-beta.0",
"version": "0.21.1-beta.1",
"os": ["linux"],
"cpu": ["x64"],
"main": "lancedb.linux-x64-musl.node",

View File

@@ -1,6 +1,6 @@
{
"name": "@lancedb/lancedb-win32-arm64-msvc",
"version": "0.21.1-beta.0",
"version": "0.21.1-beta.1",
"os": [
"win32"
],

View File

@@ -1,6 +1,6 @@
{
"name": "@lancedb/lancedb-win32-x64-msvc",
"version": "0.21.1-beta.0",
"version": "0.21.1-beta.1",
"os": ["win32"],
"cpu": ["x64"],
"main": "lancedb.win32-x64-msvc.node",

View File

@@ -1,12 +1,12 @@
{
"name": "@lancedb/lancedb",
"version": "0.21.1-beta.0",
"version": "0.21.1-beta.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@lancedb/lancedb",
"version": "0.21.1-beta.0",
"version": "0.21.1-beta.1",
"cpu": [
"x64",
"arm64"

View File

@@ -11,7 +11,7 @@
"ann"
],
"private": false,
"version": "0.21.1-beta.0",
"version": "0.21.1-beta.1",
"main": "dist/index.js",
"exports": {
".": "./dist/index.js",

View File

@@ -45,6 +45,16 @@ class LanceMergeInsertBuilder(object):
If there are multiple matches then the behavior is undefined.
Currently this causes multiple copies of the row to be created
but that behavior is subject to change.
Parameters
----------
where : Optional[str], default None
A SQL filter expression to apply to matched rows. The filter must
specify whether you are referencing the source table (new data) or
the target table (existing data) by prefixing column names with
"source." or "target." respectively.
Example: "target.status = 'active'" or "source.price > target.price"
"""
self._when_matched_update_all = True
self._when_matched_update_all_condition = where

View File

@@ -89,7 +89,7 @@ class RemoteTable(Table):
def to_pandas(self):
"""to_pandas() is not yet supported on LanceDB cloud."""
return NotImplementedError("to_pandas() is not yet supported on LanceDB cloud.")
raise NotImplementedError("to_pandas() is not yet supported on LanceDB cloud.")
def checkout(self, version: Union[int, str]):
return LOOP.run(self._table.checkout(version))

View File

@@ -210,6 +210,25 @@ async def test_retry_error():
assert cause.status_code == 429
def test_table_unimplemented_functions():
def handler(request):
if request.path == "/v1/table/test/create/?mode=create":
request.send_response(200)
request.send_header("Content-Type", "application/json")
request.end_headers()
request.wfile.write(b"{}")
else:
request.send_response(404)
request.end_headers()
with mock_lancedb_connection(handler) as db:
table = db.create_table("test", [{"id": 1}])
with pytest.raises(NotImplementedError):
table.to_arrow()
with pytest.raises(NotImplementedError):
table.to_pandas()
def test_table_add_in_threadpool():
def handler(request):
if request.path == "/v1/table/test/insert/":

View File

@@ -1,6 +1,6 @@
[package]
name = "lancedb-node"
version = "0.21.1-beta.0"
version = "0.21.1-beta.1"
description = "Serverless, low-latency vector database for AI applications"
license.workspace = true
edition.workspace = true

View File

@@ -1,6 +1,6 @@
[package]
name = "lancedb"
version = "0.21.1-beta.0"
version = "0.21.1-beta.1"
edition.workspace = true
description = "LanceDB: A serverless, low-latency vector database for AI applications"
license.workspace = true