mirror of
https://github.com/lancedb/lancedb.git
synced 2026-01-05 19:32:56 +00:00
Compare commits
1 Commits
rmeng/upgr
...
remote-tab
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3965d1584c |
@@ -1,5 +1,5 @@
|
|||||||
[bumpversion]
|
[bumpversion]
|
||||||
current_version = 0.4.18
|
current_version = 0.4.17
|
||||||
commit = True
|
commit = True
|
||||||
message = Bump version: {current_version} → {new_version}
|
message = Bump version: {current_version} → {new_version}
|
||||||
tag = True
|
tag = True
|
||||||
|
|||||||
26
Cargo.toml
26
Cargo.toml
@@ -14,22 +14,22 @@ keywords = ["lancedb", "lance", "database", "vector", "search"]
|
|||||||
categories = ["database-implementations"]
|
categories = ["database-implementations"]
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
lance = { "version" = "=0.10.18", "features" = ["dynamodb"] }
|
lance = { "version" = "=0.10.15", "features" = ["dynamodb"] }
|
||||||
lance-index = { "version" = "=0.10.18" }
|
lance-index = { "version" = "=0.10.15" }
|
||||||
lance-linalg = { "version" = "=0.10.18" }
|
lance-linalg = { "version" = "=0.10.15" }
|
||||||
lance-testing = { "version" = "=0.10.18" }
|
lance-testing = { "version" = "=0.10.15" }
|
||||||
# Note that this one does not include pyarrow
|
# Note that this one does not include pyarrow
|
||||||
arrow = { version = "51.0", optional = false }
|
arrow = { version = "50.0", optional = false }
|
||||||
arrow-array = "51.0"
|
arrow-array = "50.0"
|
||||||
arrow-data = "51.0"
|
arrow-data = "50.0"
|
||||||
arrow-ipc = "51.0"
|
arrow-ipc = "50.0"
|
||||||
arrow-ord = "51.0"
|
arrow-ord = "50.0"
|
||||||
arrow-schema = "51.0"
|
arrow-schema = "50.0"
|
||||||
arrow-arith = "51.0"
|
arrow-arith = "50.0"
|
||||||
arrow-cast = "51.0"
|
arrow-cast = "50.0"
|
||||||
async-trait = "0"
|
async-trait = "0"
|
||||||
chrono = "0.4.35"
|
chrono = "0.4.35"
|
||||||
half = { "version" = "2.4.1", default-features = false, features = [
|
half = { "version" = "=2.3.1", default-features = false, features = [
|
||||||
"num-traits",
|
"num-traits",
|
||||||
] }
|
] }
|
||||||
futures = "0"
|
futures = "0"
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ Allows you to set parameters when registering a `sentence-transformers` object.
|
|||||||
from lancedb.embeddings import get_registry
|
from lancedb.embeddings import get_registry
|
||||||
|
|
||||||
db = lancedb.connect("/tmp/db")
|
db = lancedb.connect("/tmp/db")
|
||||||
model = get_registry().get("sentence-transformers").create(name="BAAI/bge-small-en-v1.5", device="cpu")
|
model = get_registry.get("sentence-transformers").create(name="BAAI/bge-small-en-v1.5", device="cpu")
|
||||||
|
|
||||||
class Words(LanceModel):
|
class Words(LanceModel):
|
||||||
text: str = model.SourceField()
|
text: str = model.SourceField()
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ For this purpose, LanceDB introduces an **embedding functions API**, that allow
|
|||||||
|
|
||||||
```python
|
```python
|
||||||
class Pets(LanceModel):
|
class Pets(LanceModel):
|
||||||
vector: Vector(clip.ndims()) = clip.VectorField()
|
vector: Vector(clip.ndims) = clip.VectorField()
|
||||||
image_uri: str = clip.SourceField()
|
image_uri: str = clip.SourceField()
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ You can also use the integration for adding utility operations in the schema. Fo
|
|||||||
|
|
||||||
```python
|
```python
|
||||||
class Pets(LanceModel):
|
class Pets(LanceModel):
|
||||||
vector: Vector(clip.ndims()) = clip.VectorField()
|
vector: Vector(clip.ndims) = clip.VectorField()
|
||||||
image_uri: str = clip.SourceField()
|
image_uri: str = clip.SourceField()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -166,4 +166,4 @@ rs[2].image
|
|||||||

|

|
||||||
|
|
||||||
Now that you have the basic idea about LanceDB embedding functions and the embedding function registry,
|
Now that you have the basic idea about LanceDB embedding functions and the embedding function registry,
|
||||||
let's dive deeper into defining your own [custom functions](./custom_embedding_function.md).
|
let's dive deeper into defining your own [custom functions](./custom_embedding_function.md).
|
||||||
74
node/package-lock.json
generated
74
node/package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "vectordb",
|
"name": "vectordb",
|
||||||
"version": "0.4.18",
|
"version": "0.4.17",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "vectordb",
|
"name": "vectordb",
|
||||||
"version": "0.4.18",
|
"version": "0.4.17",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64",
|
"x64",
|
||||||
"arm64"
|
"arm64"
|
||||||
@@ -52,11 +52,11 @@
|
|||||||
"uuid": "^9.0.0"
|
"uuid": "^9.0.0"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@lancedb/vectordb-darwin-arm64": "0.4.18",
|
"@lancedb/vectordb-darwin-arm64": "0.4.17",
|
||||||
"@lancedb/vectordb-darwin-x64": "0.4.18",
|
"@lancedb/vectordb-darwin-x64": "0.4.17",
|
||||||
"@lancedb/vectordb-linux-arm64-gnu": "0.4.18",
|
"@lancedb/vectordb-linux-arm64-gnu": "0.4.17",
|
||||||
"@lancedb/vectordb-linux-x64-gnu": "0.4.18",
|
"@lancedb/vectordb-linux-x64-gnu": "0.4.17",
|
||||||
"@lancedb/vectordb-win32-x64-msvc": "0.4.18"
|
"@lancedb/vectordb-win32-x64-msvc": "0.4.17"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@apache-arrow/ts": "^14.0.2",
|
"@apache-arrow/ts": "^14.0.2",
|
||||||
@@ -333,66 +333,6 @@
|
|||||||
"@jridgewell/sourcemap-codec": "^1.4.10"
|
"@jridgewell/sourcemap-codec": "^1.4.10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@lancedb/vectordb-darwin-arm64": {
|
|
||||||
"version": "0.4.18",
|
|
||||||
"resolved": "https://registry.npmjs.org/@lancedb/vectordb-darwin-arm64/-/vectordb-darwin-arm64-0.4.18.tgz",
|
|
||||||
"integrity": "sha512-CzJbkBKz30U0ocFFhRLV3ZPRZh3MtAkOmFr76jxRWeXLPM/JcLvhGOAnW9h/XdTONidHOfHNZnUtrjeWDMCyig==",
|
|
||||||
"cpu": [
|
|
||||||
"arm64"
|
|
||||||
],
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"darwin"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"node_modules/@lancedb/vectordb-darwin-x64": {
|
|
||||||
"version": "0.4.18",
|
|
||||||
"resolved": "https://registry.npmjs.org/@lancedb/vectordb-darwin-x64/-/vectordb-darwin-x64-0.4.18.tgz",
|
|
||||||
"integrity": "sha512-wyqpfdDBE5g+8SLN/6E/r37smt5i+4H3MVNZ2GZfvcMAd4xIZTwGAf5Mfx8j15t3mvKMiBEZPTvYQfFde2bQmA==",
|
|
||||||
"cpu": [
|
|
||||||
"x64"
|
|
||||||
],
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"darwin"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"node_modules/@lancedb/vectordb-linux-arm64-gnu": {
|
|
||||||
"version": "0.4.18",
|
|
||||||
"resolved": "https://registry.npmjs.org/@lancedb/vectordb-linux-arm64-gnu/-/vectordb-linux-arm64-gnu-0.4.18.tgz",
|
|
||||||
"integrity": "sha512-OfCjTrwfdmT9Qh5r92AUj7Wosvl8mSYADS6rp+ofNoht9nq1UqtlyrCot1RhuF5w6UW1aLCJXycXY0qHh1WUPw==",
|
|
||||||
"cpu": [
|
|
||||||
"arm64"
|
|
||||||
],
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"linux"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"node_modules/@lancedb/vectordb-linux-x64-gnu": {
|
|
||||||
"version": "0.4.18",
|
|
||||||
"resolved": "https://registry.npmjs.org/@lancedb/vectordb-linux-x64-gnu/-/vectordb-linux-x64-gnu-0.4.18.tgz",
|
|
||||||
"integrity": "sha512-uJiCminsZQ6oUvVYEElgN+/Lqd9646cJUWCbfiFSnt10PCj/kFBXWjKEuCxfG/A0bp6DTm5mU5RYWDfY9v3T0Q==",
|
|
||||||
"cpu": [
|
|
||||||
"x64"
|
|
||||||
],
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"linux"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"node_modules/@lancedb/vectordb-win32-x64-msvc": {
|
|
||||||
"version": "0.4.18",
|
|
||||||
"resolved": "https://registry.npmjs.org/@lancedb/vectordb-win32-x64-msvc/-/vectordb-win32-x64-msvc-0.4.18.tgz",
|
|
||||||
"integrity": "sha512-T9//HlvtNDHEfbIjz0ExLQFbqKFHRdaKf3jpFECt5oJdU0VCXe5460DIMvp6w/SDf24pb1UvOjZnmPLvX4yPNg==",
|
|
||||||
"cpu": [
|
|
||||||
"x64"
|
|
||||||
],
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"win32"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"node_modules/@neon-rs/cli": {
|
"node_modules/@neon-rs/cli": {
|
||||||
"version": "0.0.160",
|
"version": "0.0.160",
|
||||||
"resolved": "https://registry.npmjs.org/@neon-rs/cli/-/cli-0.0.160.tgz",
|
"resolved": "https://registry.npmjs.org/@neon-rs/cli/-/cli-0.0.160.tgz",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vectordb",
|
"name": "vectordb",
|
||||||
"version": "0.4.18",
|
"version": "0.4.17",
|
||||||
"description": " Serverless, low-latency vector database for AI applications",
|
"description": " Serverless, low-latency vector database for AI applications",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
@@ -88,10 +88,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@lancedb/vectordb-darwin-arm64": "0.4.18",
|
"@lancedb/vectordb-darwin-arm64": "0.4.17",
|
||||||
"@lancedb/vectordb-darwin-x64": "0.4.18",
|
"@lancedb/vectordb-darwin-x64": "0.4.17",
|
||||||
"@lancedb/vectordb-linux-arm64-gnu": "0.4.18",
|
"@lancedb/vectordb-linux-arm64-gnu": "0.4.17",
|
||||||
"@lancedb/vectordb-linux-x64-gnu": "0.4.18",
|
"@lancedb/vectordb-linux-x64-gnu": "0.4.17",
|
||||||
"@lancedb/vectordb-win32-x64-msvc": "0.4.18"
|
"@lancedb/vectordb-win32-x64-msvc": "0.4.17"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,9 +140,6 @@ export class RemoteConnection implements Connection {
|
|||||||
schema = nameOrOpts.schema
|
schema = nameOrOpts.schema
|
||||||
embeddings = nameOrOpts.embeddingFunction
|
embeddings = nameOrOpts.embeddingFunction
|
||||||
tableName = nameOrOpts.name
|
tableName = nameOrOpts.name
|
||||||
if (data === undefined) {
|
|
||||||
data = nameOrOpts.data
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let buffer: Buffer
|
let buffer: Buffer
|
||||||
|
|||||||
1
nodejs/.gitignore
vendored
1
nodejs/.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
yarn.lock
|
|
||||||
@@ -77,18 +77,6 @@ export interface OpenTableOptions {
|
|||||||
* The available options are described at https://lancedb.github.io/lancedb/guides/storage/
|
* The available options are described at https://lancedb.github.io/lancedb/guides/storage/
|
||||||
*/
|
*/
|
||||||
storageOptions?: Record<string, string>;
|
storageOptions?: Record<string, string>;
|
||||||
/**
|
|
||||||
* Set the size of the index cache, specified as a number of entries
|
|
||||||
*
|
|
||||||
* The exact meaning of an "entry" will depend on the type of index:
|
|
||||||
* - IVF: there is one entry for each IVF partition
|
|
||||||
* - BTREE: there is one entry for the entire index
|
|
||||||
*
|
|
||||||
* This cache applies to the entire opened table, across all indices.
|
|
||||||
* Setting this value higher will increase performance on larger datasets
|
|
||||||
* at the expense of more RAM
|
|
||||||
*/
|
|
||||||
indexCacheSize?: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TableNamesOptions {
|
export interface TableNamesOptions {
|
||||||
@@ -172,7 +160,6 @@ export class Connection {
|
|||||||
const innerTable = await this.inner.openTable(
|
const innerTable = await this.inner.openTable(
|
||||||
name,
|
name,
|
||||||
cleanseStorageOptions(options?.storageOptions),
|
cleanseStorageOptions(options?.storageOptions),
|
||||||
options?.indexCacheSize,
|
|
||||||
);
|
);
|
||||||
return new Table(innerTable);
|
return new Table(innerTable);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,20 +169,17 @@ export class Table {
|
|||||||
* // If the column has a vector (fixed size list) data type then
|
* // If the column has a vector (fixed size list) data type then
|
||||||
* // an IvfPq vector index will be created.
|
* // an IvfPq vector index will be created.
|
||||||
* const table = await conn.openTable("my_table");
|
* const table = await conn.openTable("my_table");
|
||||||
* await table.createIndex("vector");
|
* await table.createIndex(["vector"]);
|
||||||
* @example
|
* @example
|
||||||
* // For advanced control over vector index creation you can specify
|
* // For advanced control over vector index creation you can specify
|
||||||
* // the index type and options.
|
* // the index type and options.
|
||||||
* const table = await conn.openTable("my_table");
|
* const table = await conn.openTable("my_table");
|
||||||
* await table.createIndex("vector", {
|
* await table.createIndex(["vector"], I)
|
||||||
* config: lancedb.Index.ivfPq({
|
* .ivf_pq({ num_partitions: 128, num_sub_vectors: 16 })
|
||||||
* numPartitions: 128,
|
* .build();
|
||||||
* numSubVectors: 16,
|
|
||||||
* }),
|
|
||||||
* });
|
|
||||||
* @example
|
* @example
|
||||||
* // Or create a Scalar index
|
* // Or create a Scalar index
|
||||||
* await table.createIndex("my_float_col");
|
* await table.createIndex("my_float_col").build();
|
||||||
*/
|
*/
|
||||||
async createIndex(column: string, options?: Partial<IndexOptions>) {
|
async createIndex(column: string, options?: Partial<IndexOptions>) {
|
||||||
// Bit of a hack to get around the fact that TS has no package-scope.
|
// Bit of a hack to get around the fact that TS has no package-scope.
|
||||||
@@ -200,7 +197,8 @@ export class Table {
|
|||||||
* vector similarity, sorting, and more.
|
* vector similarity, sorting, and more.
|
||||||
*
|
*
|
||||||
* Note: By default, all columns are returned. For best performance, you should
|
* Note: By default, all columns are returned. For best performance, you should
|
||||||
* only fetch the columns you need.
|
* only fetch the columns you need. See [`Query::select_with_projection`] for
|
||||||
|
* more details.
|
||||||
*
|
*
|
||||||
* When appropriate, various indices and statistics based pruning will be used to
|
* When appropriate, various indices and statistics based pruning will be used to
|
||||||
* accelerate the query.
|
* accelerate the query.
|
||||||
@@ -208,13 +206,10 @@ export class Table {
|
|||||||
* // SQL-style filtering
|
* // SQL-style filtering
|
||||||
* //
|
* //
|
||||||
* // This query will return up to 1000 rows whose value in the `id` column
|
* // This query will return up to 1000 rows whose value in the `id` column
|
||||||
* // is greater than 5. LanceDb supports a broad set of filtering functions.
|
* // is greater than 5. LanceDb supports a broad set of filtering functions.
|
||||||
* for await (const batch of table
|
* for await (const batch of table.query()
|
||||||
* .query()
|
* .filter("id > 1").select(["id"]).limit(20)) {
|
||||||
* .where("id > 1")
|
* console.log(batch);
|
||||||
* .select(["id"])
|
|
||||||
* .limit(20)) {
|
|
||||||
* console.log(batch);
|
|
||||||
* }
|
* }
|
||||||
* @example
|
* @example
|
||||||
* // Vector Similarity Search
|
* // Vector Similarity Search
|
||||||
@@ -223,14 +218,13 @@ export class Table {
|
|||||||
* // closest to the query vector [1.0, 2.0, 3.0]. If an index has been created
|
* // closest to the query vector [1.0, 2.0, 3.0]. If an index has been created
|
||||||
* // on the "vector" column then this will perform an ANN search.
|
* // on the "vector" column then this will perform an ANN search.
|
||||||
* //
|
* //
|
||||||
* // The `refineFactor` and `nprobes` methods are used to control the recall /
|
* // The `refine_factor` and `nprobes` methods are used to control the recall /
|
||||||
* // latency tradeoff of the search.
|
* // latency tradeoff of the search.
|
||||||
* for await (const batch of table
|
* for await (const batch of table.query()
|
||||||
* .query()
|
* .nearestTo([1, 2, 3])
|
||||||
* .where("id > 1")
|
* .refineFactor(5).nprobe(10)
|
||||||
* .select(["id"])
|
* .limit(10)) {
|
||||||
* .limit(20)) {
|
* console.log(batch);
|
||||||
* console.log(batch);
|
|
||||||
* }
|
* }
|
||||||
* @example
|
* @example
|
||||||
* // Scan the full dataset
|
* // Scan the full dataset
|
||||||
@@ -292,45 +286,43 @@ export class Table {
|
|||||||
await this.inner.dropColumns(columnNames);
|
await this.inner.dropColumns(columnNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Retrieve the version of the table */
|
/**
|
||||||
|
* Retrieve the version of the table
|
||||||
|
*
|
||||||
|
* LanceDb supports versioning. Every operation that modifies the table increases
|
||||||
|
* version. As long as a version hasn't been deleted you can `[Self::checkout]` that
|
||||||
|
* version to view the data at that point. In addition, you can `[Self::restore]` the
|
||||||
|
* version to replace the current table with a previous version.
|
||||||
|
*/
|
||||||
async version(): Promise<number> {
|
async version(): Promise<number> {
|
||||||
return await this.inner.version();
|
return await this.inner.version();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks out a specific version of the table _This is an in-place operation._
|
* Checks out a specific version of the Table
|
||||||
*
|
*
|
||||||
* This allows viewing previous versions of the table. If you wish to
|
* Any read operation on the table will now access the data at the checked out version.
|
||||||
* keep writing to the dataset starting from an old version, then use
|
* As a consequence, calling this method will disable any read consistency interval
|
||||||
* the `restore` function.
|
* that was previously set.
|
||||||
*
|
*
|
||||||
* Calling this method will set the table into time-travel mode. If you
|
* This is a read-only operation that turns the table into a sort of "view"
|
||||||
* wish to return to standard mode, call `checkoutLatest`.
|
* or "detached head". Other table instances will not be affected. To make the change
|
||||||
* @param {number} version The version to checkout
|
* permanent you can use the `[Self::restore]` method.
|
||||||
* @example
|
|
||||||
* ```typescript
|
|
||||||
* import * as lancedb from "@lancedb/lancedb"
|
|
||||||
* const db = await lancedb.connect("./.lancedb");
|
|
||||||
* const table = await db.createTable("my_table", [
|
|
||||||
* { vector: [1.1, 0.9], type: "vector" },
|
|
||||||
* ]);
|
|
||||||
*
|
*
|
||||||
* console.log(await table.version()); // 1
|
* Any operation that modifies the table will fail while the table is in a checked
|
||||||
* console.log(table.display());
|
* out state.
|
||||||
* await table.add([{ vector: [0.5, 0.2], type: "vector" }]);
|
*
|
||||||
* await table.checkout(1);
|
* To return the table to a normal state use `[Self::checkout_latest]`
|
||||||
* console.log(await table.version()); // 2
|
|
||||||
* ```
|
|
||||||
*/
|
*/
|
||||||
async checkout(version: number): Promise<void> {
|
async checkout(version: number): Promise<void> {
|
||||||
await this.inner.checkout(version);
|
await this.inner.checkout(version);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checkout the latest version of the table. _This is an in-place operation._
|
* Ensures the table is pointing at the latest version
|
||||||
*
|
*
|
||||||
* The table will be set back into standard mode, and will track the latest
|
* This can be used to manually update a table when the read_consistency_interval is None
|
||||||
* version of the table.
|
* It can also be used to undo a `[Self::checkout]` operation
|
||||||
*/
|
*/
|
||||||
async checkoutLatest(): Promise<void> {
|
async checkoutLatest(): Promise<void> {
|
||||||
await this.inner.checkoutLatest();
|
await this.inner.checkoutLatest();
|
||||||
@@ -352,7 +344,9 @@ export class Table {
|
|||||||
await this.inner.restore();
|
await this.inner.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** List all indices that have been created with {@link Table.createIndex} */
|
/**
|
||||||
|
* List all indices that have been created with Self::create_index
|
||||||
|
*/
|
||||||
async listIndices(): Promise<IndexConfig[]> {
|
async listIndices(): Promise<IndexConfig[]> {
|
||||||
return await this.inner.listIndices();
|
return await this.inner.listIndices();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@lancedb/lancedb-darwin-arm64",
|
"name": "@lancedb/lancedb-darwin-arm64",
|
||||||
"version": "0.4.18",
|
"version": "0.4.17",
|
||||||
"os": [
|
"os": [
|
||||||
"darwin"
|
"darwin"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@lancedb/lancedb-darwin-x64",
|
"name": "@lancedb/lancedb-darwin-x64",
|
||||||
"version": "0.4.18",
|
"version": "0.4.17",
|
||||||
"os": [
|
"os": [
|
||||||
"darwin"
|
"darwin"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@lancedb/lancedb-linux-arm64-gnu",
|
"name": "@lancedb/lancedb-linux-arm64-gnu",
|
||||||
"version": "0.4.18",
|
"version": "0.4.17",
|
||||||
"os": [
|
"os": [
|
||||||
"linux"
|
"linux"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@lancedb/lancedb-linux-x64-gnu",
|
"name": "@lancedb/lancedb-linux-x64-gnu",
|
||||||
"version": "0.4.18",
|
"version": "0.4.17",
|
||||||
"os": [
|
"os": [
|
||||||
"linux"
|
"linux"
|
||||||
],
|
],
|
||||||
|
|||||||
86
nodejs/package-lock.json
generated
86
nodejs/package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@lancedb/lancedb",
|
"name": "@lancedb/lancedb",
|
||||||
"version": "0.4.18",
|
"version": "0.4.16",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@lancedb/lancedb",
|
"name": "@lancedb/lancedb",
|
||||||
"version": "0.4.18",
|
"version": "0.4.16",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64",
|
"x64",
|
||||||
"arm64"
|
"arm64"
|
||||||
@@ -45,6 +45,13 @@
|
|||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 18"
|
"node": ">= 18"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"@lancedb/lancedb-darwin-arm64": "0.4.16",
|
||||||
|
"@lancedb/lancedb-darwin-x64": "0.4.16",
|
||||||
|
"@lancedb/lancedb-linux-arm64-gnu": "0.4.16",
|
||||||
|
"@lancedb/lancedb-linux-x64-gnu": "0.4.16",
|
||||||
|
"@lancedb/lancedb-win32-x64-msvc": "0.4.16"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@75lb/deep-merge": {
|
"node_modules/@75lb/deep-merge": {
|
||||||
@@ -2214,6 +2221,81 @@
|
|||||||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@lancedb/lancedb-darwin-arm64": {
|
||||||
|
"version": "0.4.16",
|
||||||
|
"resolved": "https://registry.npmjs.org/@lancedb/lancedb-darwin-arm64/-/lancedb-darwin-arm64-0.4.16.tgz",
|
||||||
|
"integrity": "sha512-CV65ouIDQbBSNtdHbQSr2fqXflOuqud1cfweUS+EiK7eEOEYl7nO2oiFYO49Jy76MEwZxiP99hW825aCqIQJqg==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@lancedb/lancedb-darwin-x64": {
|
||||||
|
"version": "0.4.16",
|
||||||
|
"resolved": "https://registry.npmjs.org/@lancedb/lancedb-darwin-x64/-/lancedb-darwin-x64-0.4.16.tgz",
|
||||||
|
"integrity": "sha512-1CwIYCNdbFmV7fvqM+qUxbYgwxx0slcCV48PC/I19Ejitgtzw/NJiWDCvONhaLqG85lWNZm1xYceRpVv7b8seQ==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@lancedb/lancedb-linux-arm64-gnu": {
|
||||||
|
"version": "0.4.16",
|
||||||
|
"resolved": "https://registry.npmjs.org/@lancedb/lancedb-linux-arm64-gnu/-/lancedb-linux-arm64-gnu-0.4.16.tgz",
|
||||||
|
"integrity": "sha512-CzLEbzoHKS6jV0k52YnvsiVNx0VzLp1Vz/zmbHI6HmB/XbS67qDO93Jk71MDmXq3JDw0FKFCw9ghkg+6YWq7ZA==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@lancedb/lancedb-linux-x64-gnu": {
|
||||||
|
"version": "0.4.16",
|
||||||
|
"resolved": "https://registry.npmjs.org/@lancedb/lancedb-linux-x64-gnu/-/lancedb-linux-x64-gnu-0.4.16.tgz",
|
||||||
|
"integrity": "sha512-nKChybybi8uA0AFRHBFm7Fz3VXcRm8riv5Gs7xQsrsCtYxxf4DT/0BfUvQ0xKbwNJa+fawHRxi9BOQewdj49fg==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@lancedb/lancedb-win32-x64-msvc": {
|
||||||
|
"version": "0.4.16",
|
||||||
|
"resolved": "https://registry.npmjs.org/@lancedb/lancedb-win32-x64-msvc/-/lancedb-win32-x64-msvc-0.4.16.tgz",
|
||||||
|
"integrity": "sha512-KMeBPMpv2g+ZMVsHVibed7BydrBlxje1qS0bZTDrLw9BtZOk6XH2lh1mCDnCJI6sbAscUKNA6fDCdquhQPHL7w==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 18"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@napi-rs/cli": {
|
"node_modules/@napi-rs/cli": {
|
||||||
"version": "2.18.0",
|
"version": "2.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/@napi-rs/cli/-/cli-2.18.0.tgz",
|
"resolved": "https://registry.npmjs.org/@napi-rs/cli/-/cli-2.18.0.tgz",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@lancedb/lancedb",
|
"name": "@lancedb/lancedb",
|
||||||
"version": "0.4.18",
|
"version": "0.4.17",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
"napi": {
|
"napi": {
|
||||||
@@ -62,14 +62,20 @@
|
|||||||
"build-release": "npm run build:release && tsc -b && shx cp lancedb/native.d.ts dist/native.d.ts",
|
"build-release": "npm run build:release && tsc -b && shx cp lancedb/native.d.ts dist/native.d.ts",
|
||||||
"chkformat": "prettier . --check",
|
"chkformat": "prettier . --check",
|
||||||
"docs": "typedoc --plugin typedoc-plugin-markdown --out ../docs/src/js lancedb/index.ts",
|
"docs": "typedoc --plugin typedoc-plugin-markdown --out ../docs/src/js lancedb/index.ts",
|
||||||
"lint": "eslint lancedb __test__",
|
"lint": "eslint lancedb && eslint __test__",
|
||||||
"lint-fix": "eslint lancedb __test__ --fix",
|
|
||||||
"prepublishOnly": "napi prepublish -t npm",
|
"prepublishOnly": "napi prepublish -t npm",
|
||||||
"test": "npm run build && jest --verbose",
|
"test": "npm run build && jest --verbose",
|
||||||
"integration": "S3_TEST=1 npm run test",
|
"integration": "S3_TEST=1 npm run test",
|
||||||
"universal": "napi universal",
|
"universal": "napi universal",
|
||||||
"version": "napi version"
|
"version": "napi version"
|
||||||
},
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"@lancedb/lancedb-darwin-arm64": "0.4.17",
|
||||||
|
"@lancedb/lancedb-darwin-x64": "0.4.17",
|
||||||
|
"@lancedb/lancedb-linux-arm64-gnu": "0.4.17",
|
||||||
|
"@lancedb/lancedb-linux-x64-gnu": "0.4.17",
|
||||||
|
"@lancedb/lancedb-win32-x64-msvc": "0.4.17"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"openai": "^4.29.2",
|
"openai": "^4.29.2",
|
||||||
"apache-arrow": "^15.0.0"
|
"apache-arrow": "^15.0.0"
|
||||||
|
|||||||
@@ -176,7 +176,6 @@ impl Connection {
|
|||||||
&self,
|
&self,
|
||||||
name: String,
|
name: String,
|
||||||
storage_options: Option<HashMap<String, String>>,
|
storage_options: Option<HashMap<String, String>>,
|
||||||
index_cache_size: Option<u32>,
|
|
||||||
) -> napi::Result<Table> {
|
) -> napi::Result<Table> {
|
||||||
let mut builder = self.get_inner()?.open_table(&name);
|
let mut builder = self.get_inner()?.open_table(&name);
|
||||||
if let Some(storage_options) = storage_options {
|
if let Some(storage_options) = storage_options {
|
||||||
@@ -184,9 +183,6 @@ impl Connection {
|
|||||||
builder = builder.storage_option(key, value);
|
builder = builder.storage_option(key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(index_cache_size) = index_cache_size {
|
|
||||||
builder = builder.index_cache_size(index_cache_size);
|
|
||||||
}
|
|
||||||
let tbl = builder
|
let tbl = builder
|
||||||
.execute()
|
.execute()
|
||||||
.await
|
.await
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[bumpversion]
|
[bumpversion]
|
||||||
current_version = 0.6.11
|
current_version = 0.6.9
|
||||||
commit = True
|
commit = True
|
||||||
message = [python] Bump version: {current_version} → {new_version}
|
message = [python] Bump version: {current_version} → {new_version}
|
||||||
tag = True
|
tag = True
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ name = "_lancedb"
|
|||||||
crate-type = ["cdylib"]
|
crate-type = ["cdylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
arrow = { version = "51.0.0", features = ["pyarrow"] }
|
arrow = { version = "50.0.0", features = ["pyarrow"] }
|
||||||
lancedb = { path = "../rust/lancedb" }
|
lancedb = { path = "../rust/lancedb" }
|
||||||
env_logger = "0.10"
|
env_logger = "0.10"
|
||||||
pyo3 = { version = "0.20", features = ["extension-module", "abi3-py38"] }
|
pyo3 = { version = "0.20", features = ["extension-module", "abi3-py38"] }
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "lancedb"
|
name = "lancedb"
|
||||||
version = "0.6.11"
|
version = "0.6.9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"deprecation",
|
"deprecation",
|
||||||
"pylance==0.10.12",
|
"pylance==0.10.12",
|
||||||
|
|||||||
@@ -224,23 +224,13 @@ class DBConnection(EnforceOverrides):
|
|||||||
def __getitem__(self, name: str) -> LanceTable:
|
def __getitem__(self, name: str) -> LanceTable:
|
||||||
return self.open_table(name)
|
return self.open_table(name)
|
||||||
|
|
||||||
def open_table(self, name: str, *, index_cache_size: Optional[int] = None) -> Table:
|
def open_table(self, name: str) -> Table:
|
||||||
"""Open a Lance Table in the database.
|
"""Open a Lance Table in the database.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
name: str
|
name: str
|
||||||
The name of the table.
|
The name of the table.
|
||||||
index_cache_size: int, default 256
|
|
||||||
Set the size of the index cache, specified as a number of entries
|
|
||||||
|
|
||||||
The exact meaning of an "entry" will depend on the type of index:
|
|
||||||
* IVF - there is one entry for each IVF partition
|
|
||||||
* BTREE - there is one entry for the entire index
|
|
||||||
|
|
||||||
This cache applies to the entire opened table, across all indices.
|
|
||||||
Setting this value higher will increase performance on larger datasets
|
|
||||||
at the expense of more RAM
|
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
@@ -258,18 +248,6 @@ class DBConnection(EnforceOverrides):
|
|||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def rename_table(self, cur_name: str, new_name: str):
|
|
||||||
"""Rename a table in the database.
|
|
||||||
|
|
||||||
Parameters
|
|
||||||
----------
|
|
||||||
cur_name: str
|
|
||||||
The current name of the table.
|
|
||||||
new_name: str
|
|
||||||
The new name of the table.
|
|
||||||
"""
|
|
||||||
raise NotImplementedError
|
|
||||||
|
|
||||||
def drop_database(self):
|
def drop_database(self):
|
||||||
"""
|
"""
|
||||||
Drop database
|
Drop database
|
||||||
@@ -429,9 +407,7 @@ class LanceDBConnection(DBConnection):
|
|||||||
return tbl
|
return tbl
|
||||||
|
|
||||||
@override
|
@override
|
||||||
def open_table(
|
def open_table(self, name: str) -> LanceTable:
|
||||||
self, name: str, *, index_cache_size: Optional[int] = None
|
|
||||||
) -> LanceTable:
|
|
||||||
"""Open a table in the database.
|
"""Open a table in the database.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
@@ -443,7 +419,7 @@ class LanceDBConnection(DBConnection):
|
|||||||
-------
|
-------
|
||||||
A LanceTable object representing the table.
|
A LanceTable object representing the table.
|
||||||
"""
|
"""
|
||||||
return LanceTable.open(self, name, index_cache_size=index_cache_size)
|
return LanceTable.open(self, name)
|
||||||
|
|
||||||
@override
|
@override
|
||||||
def drop_table(self, name: str, ignore_missing: bool = False):
|
def drop_table(self, name: str, ignore_missing: bool = False):
|
||||||
@@ -775,10 +751,7 @@ class AsyncConnection(object):
|
|||||||
return AsyncTable(new_table)
|
return AsyncTable(new_table)
|
||||||
|
|
||||||
async def open_table(
|
async def open_table(
|
||||||
self,
|
self, name: str, storage_options: Optional[Dict[str, str]] = None
|
||||||
name: str,
|
|
||||||
storage_options: Optional[Dict[str, str]] = None,
|
|
||||||
index_cache_size: Optional[int] = None,
|
|
||||||
) -> Table:
|
) -> Table:
|
||||||
"""Open a Lance Table in the database.
|
"""Open a Lance Table in the database.
|
||||||
|
|
||||||
@@ -791,22 +764,12 @@ class AsyncConnection(object):
|
|||||||
connection will be inherited by the table, but can be overridden here.
|
connection will be inherited by the table, but can be overridden here.
|
||||||
See available options at
|
See available options at
|
||||||
https://lancedb.github.io/lancedb/guides/storage/
|
https://lancedb.github.io/lancedb/guides/storage/
|
||||||
index_cache_size: int, default 256
|
|
||||||
Set the size of the index cache, specified as a number of entries
|
|
||||||
|
|
||||||
The exact meaning of an "entry" will depend on the type of index:
|
|
||||||
* IVF - there is one entry for each IVF partition
|
|
||||||
* BTREE - there is one entry for the entire index
|
|
||||||
|
|
||||||
This cache applies to the entire opened table, across all indices.
|
|
||||||
Setting this value higher will increase performance on larger datasets
|
|
||||||
at the expense of more RAM
|
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
A LanceTable object representing the table.
|
A LanceTable object representing the table.
|
||||||
"""
|
"""
|
||||||
table = await self._inner.open_table(name, storage_options, index_cache_size)
|
table = await self._inner.open_table(name, storage_options)
|
||||||
return AsyncTable(table)
|
return AsyncTable(table)
|
||||||
|
|
||||||
async def drop_table(self, name: str):
|
async def drop_table(self, name: str):
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class RemoteDBConnection(DBConnection):
|
|||||||
yield item
|
yield item
|
||||||
|
|
||||||
@override
|
@override
|
||||||
def open_table(self, name: str, *, index_cache_size: Optional[int] = None) -> Table:
|
def open_table(self, name: str) -> Table:
|
||||||
"""Open a Lance Table in the database.
|
"""Open a Lance Table in the database.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
@@ -110,12 +110,6 @@ class RemoteDBConnection(DBConnection):
|
|||||||
|
|
||||||
self._client.mount_retry_adapter_for_table(name)
|
self._client.mount_retry_adapter_for_table(name)
|
||||||
|
|
||||||
if index_cache_size is not None:
|
|
||||||
logging.info(
|
|
||||||
"index_cache_size is ignored in LanceDb Cloud"
|
|
||||||
" (there is no local cache to configure)"
|
|
||||||
)
|
|
||||||
|
|
||||||
# check if table exists
|
# check if table exists
|
||||||
if self._table_cache.get(name) is None:
|
if self._table_cache.get(name) is None:
|
||||||
self._client.post(f"/v1/table/{name}/describe/")
|
self._client.post(f"/v1/table/{name}/describe/")
|
||||||
@@ -287,24 +281,6 @@ class RemoteDBConnection(DBConnection):
|
|||||||
)
|
)
|
||||||
self._table_cache.pop(name)
|
self._table_cache.pop(name)
|
||||||
|
|
||||||
@override
|
|
||||||
def rename_table(self, cur_name: str, new_name: str):
|
|
||||||
"""Rename a table in the database.
|
|
||||||
|
|
||||||
Parameters
|
|
||||||
----------
|
|
||||||
cur_name: str
|
|
||||||
The current name of the table.
|
|
||||||
new_name: str
|
|
||||||
The new name of the table.
|
|
||||||
"""
|
|
||||||
self._client.post(
|
|
||||||
f"/v1/table/{cur_name}/rename/",
|
|
||||||
json={"new_table_name": new_name},
|
|
||||||
)
|
|
||||||
self._table_cache.pop(cur_name)
|
|
||||||
self._table_cache[new_name] = True
|
|
||||||
|
|
||||||
async def close(self):
|
async def close(self):
|
||||||
"""Close the connection to the database."""
|
"""Close the connection to the database."""
|
||||||
self._client.close()
|
self._client.close()
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class RemoteTable(Table):
|
|||||||
return resp
|
return resp
|
||||||
|
|
||||||
def index_stats(self, index_uuid: str):
|
def index_stats(self, index_uuid: str):
|
||||||
"""List all the stats of a specified index"""
|
"""List all the indices on the table"""
|
||||||
resp = self._conn._client.post(
|
resp = self._conn._client.post(
|
||||||
f"/v1/table/{self._name}/index/{index_uuid}/stats/"
|
f"/v1/table/{self._name}/index/{index_uuid}/stats/"
|
||||||
)
|
)
|
||||||
@@ -485,6 +485,64 @@ class RemoteTable(Table):
|
|||||||
|
|
||||||
payload = {"predicate": where, "updates": updates}
|
payload = {"predicate": where, "updates": updates}
|
||||||
self._conn._client.post(f"/v1/table/{self._name}/update/", data=payload)
|
self._conn._client.post(f"/v1/table/{self._name}/update/", data=payload)
|
||||||
|
|
||||||
|
def checkout(self, version: int):
|
||||||
|
"""Checkout a version of the table. This is an in-place operation.
|
||||||
|
|
||||||
|
This allows viewing previous versions of the table. If you wish to
|
||||||
|
keep writing to the dataset starting from an old version, then use
|
||||||
|
the `restore` function.
|
||||||
|
|
||||||
|
Calling this method will set the table into time-travel mode. If you
|
||||||
|
wish to return to standard mode, call `checkout_latest`.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
version : int
|
||||||
|
The version to checkout.
|
||||||
|
|
||||||
|
Examples ??? to be changed
|
||||||
|
--------
|
||||||
|
>>> import lancedb
|
||||||
|
>>> data = [{"vector": [1.1, 0.9], "type": "vector"}]
|
||||||
|
>>> db = lancedb.connect("db://...", api_key="...", # doctest: +SKIP
|
||||||
|
... region="...") # doctest: +SKIP
|
||||||
|
>>> table = db.create_table("my_table", data) # doctest: +SKIP
|
||||||
|
>>> table.version
|
||||||
|
2
|
||||||
|
>>> table.to_pandas()
|
||||||
|
vector type
|
||||||
|
0 [1.1, 0.9] vector
|
||||||
|
>>> table.add([{"vector": [0.5, 0.2], "type": "vector"}])
|
||||||
|
>>> table.version
|
||||||
|
3
|
||||||
|
>>> table.checkout(2)
|
||||||
|
>>> table.to_pandas()
|
||||||
|
vector type
|
||||||
|
0 [1.1, 0.9] vector
|
||||||
|
"""
|
||||||
|
|
||||||
|
def checkout_latest(self):
|
||||||
|
"""checkout_latest() is not yet supported on LanceDB cloud"""
|
||||||
|
raise NotImplementedError("checkout_latest() is not yet supported on LanceDB cloud")
|
||||||
|
|
||||||
|
def restore(self, version: int = None):
|
||||||
|
"""Restore a version of the table. This is an in-place operation.
|
||||||
|
|
||||||
|
This creates a new version where the data is equivalent to the
|
||||||
|
specified previous version. Data is not copied (as of python-v0.2.1).
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
version : int, default None
|
||||||
|
The version to restore. If unspecified then restores the currently
|
||||||
|
checked out version. If the currently checked out version is the
|
||||||
|
latest version then this is a no-op.
|
||||||
|
Examples
|
||||||
|
--------
|
||||||
|
>>> import lancedb
|
||||||
|
"""
|
||||||
|
max_version =
|
||||||
|
|
||||||
def cleanup_old_versions(self, *_):
|
def cleanup_old_versions(self, *_):
|
||||||
"""cleanup_old_versions() is not supported on the LanceDB cloud"""
|
"""cleanup_old_versions() is not supported on the LanceDB cloud"""
|
||||||
|
|||||||
@@ -806,7 +806,6 @@ class _LanceLatestDatasetRef(_LanceDatasetRef):
|
|||||||
"""Reference to the latest version of a LanceDataset."""
|
"""Reference to the latest version of a LanceDataset."""
|
||||||
|
|
||||||
uri: str
|
uri: str
|
||||||
index_cache_size: Optional[int] = None
|
|
||||||
read_consistency_interval: Optional[timedelta] = None
|
read_consistency_interval: Optional[timedelta] = None
|
||||||
last_consistency_check: Optional[float] = None
|
last_consistency_check: Optional[float] = None
|
||||||
_dataset: Optional[LanceDataset] = None
|
_dataset: Optional[LanceDataset] = None
|
||||||
@@ -814,9 +813,7 @@ class _LanceLatestDatasetRef(_LanceDatasetRef):
|
|||||||
@property
|
@property
|
||||||
def dataset(self) -> LanceDataset:
|
def dataset(self) -> LanceDataset:
|
||||||
if not self._dataset:
|
if not self._dataset:
|
||||||
self._dataset = lance.dataset(
|
self._dataset = lance.dataset(self.uri)
|
||||||
self.uri, index_cache_size=self.index_cache_size
|
|
||||||
)
|
|
||||||
self.last_consistency_check = time.monotonic()
|
self.last_consistency_check = time.monotonic()
|
||||||
elif self.read_consistency_interval is not None:
|
elif self.read_consistency_interval is not None:
|
||||||
now = time.monotonic()
|
now = time.monotonic()
|
||||||
@@ -845,15 +842,12 @@ class _LanceLatestDatasetRef(_LanceDatasetRef):
|
|||||||
class _LanceTimeTravelRef(_LanceDatasetRef):
|
class _LanceTimeTravelRef(_LanceDatasetRef):
|
||||||
uri: str
|
uri: str
|
||||||
version: int
|
version: int
|
||||||
index_cache_size: Optional[int] = None
|
|
||||||
_dataset: Optional[LanceDataset] = None
|
_dataset: Optional[LanceDataset] = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dataset(self) -> LanceDataset:
|
def dataset(self) -> LanceDataset:
|
||||||
if not self._dataset:
|
if not self._dataset:
|
||||||
self._dataset = lance.dataset(
|
self._dataset = lance.dataset(self.uri, version=self.version)
|
||||||
self.uri, version=self.version, index_cache_size=self.index_cache_size
|
|
||||||
)
|
|
||||||
return self._dataset
|
return self._dataset
|
||||||
|
|
||||||
@dataset.setter
|
@dataset.setter
|
||||||
@@ -890,8 +884,6 @@ class LanceTable(Table):
|
|||||||
connection: "LanceDBConnection",
|
connection: "LanceDBConnection",
|
||||||
name: str,
|
name: str,
|
||||||
version: Optional[int] = None,
|
version: Optional[int] = None,
|
||||||
*,
|
|
||||||
index_cache_size: Optional[int] = None,
|
|
||||||
):
|
):
|
||||||
self._conn = connection
|
self._conn = connection
|
||||||
self.name = name
|
self.name = name
|
||||||
@@ -900,13 +892,11 @@ class LanceTable(Table):
|
|||||||
self._ref = _LanceTimeTravelRef(
|
self._ref = _LanceTimeTravelRef(
|
||||||
uri=self._dataset_uri,
|
uri=self._dataset_uri,
|
||||||
version=version,
|
version=version,
|
||||||
index_cache_size=index_cache_size,
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self._ref = _LanceLatestDatasetRef(
|
self._ref = _LanceLatestDatasetRef(
|
||||||
uri=self._dataset_uri,
|
uri=self._dataset_uri,
|
||||||
read_consistency_interval=connection.read_consistency_interval,
|
read_consistency_interval=connection.read_consistency_interval,
|
||||||
index_cache_size=index_cache_size,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@@ -368,15 +368,6 @@ async def test_create_exist_ok_async(tmp_path):
|
|||||||
# await db.create_table("test", schema=bad_schema, exist_ok=True)
|
# await db.create_table("test", schema=bad_schema, exist_ok=True)
|
||||||
|
|
||||||
|
|
||||||
def test_open_table_sync(tmp_path):
|
|
||||||
db = lancedb.connect(tmp_path)
|
|
||||||
db.create_table("test", data=[{"id": 0}])
|
|
||||||
assert db.open_table("test").count_rows() == 1
|
|
||||||
assert db.open_table("test", index_cache_size=0).count_rows() == 1
|
|
||||||
with pytest.raises(FileNotFoundError, match="does not exist"):
|
|
||||||
db.open_table("does_not_exist")
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_open_table(tmp_path):
|
async def test_open_table(tmp_path):
|
||||||
db = await lancedb.connect_async(tmp_path)
|
db = await lancedb.connect_async(tmp_path)
|
||||||
@@ -406,10 +397,6 @@ async def test_open_table(tmp_path):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
# No way to verify this yet, but at least make sure we
|
|
||||||
# can pass the parameter
|
|
||||||
await db.open_table("test", index_cache_size=0)
|
|
||||||
|
|
||||||
with pytest.raises(ValueError, match="was not found"):
|
with pytest.raises(ValueError, match="was not found"):
|
||||||
await db.open_table("does_not_exist")
|
await db.open_table("does_not_exist")
|
||||||
|
|
||||||
|
|||||||
@@ -134,21 +134,17 @@ impl Connection {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyo3(signature = (name, storage_options = None, index_cache_size = None))]
|
#[pyo3(signature = (name, storage_options = None))]
|
||||||
pub fn open_table(
|
pub fn open_table(
|
||||||
self_: PyRef<'_, Self>,
|
self_: PyRef<'_, Self>,
|
||||||
name: String,
|
name: String,
|
||||||
storage_options: Option<HashMap<String, String>>,
|
storage_options: Option<HashMap<String, String>>,
|
||||||
index_cache_size: Option<u32>,
|
|
||||||
) -> PyResult<&PyAny> {
|
) -> PyResult<&PyAny> {
|
||||||
let inner = self_.get_inner()?.clone();
|
let inner = self_.get_inner()?.clone();
|
||||||
let mut builder = inner.open_table(name);
|
let mut builder = inner.open_table(name);
|
||||||
if let Some(storage_options) = storage_options {
|
if let Some(storage_options) = storage_options {
|
||||||
builder = builder.storage_options(storage_options);
|
builder = builder.storage_options(storage_options);
|
||||||
}
|
}
|
||||||
if let Some(index_cache_size) = index_cache_size {
|
|
||||||
builder = builder.index_cache_size(index_cache_size);
|
|
||||||
}
|
|
||||||
future_into_py(self_.py(), async move {
|
future_into_py(self_.py(), async move {
|
||||||
let table = builder.execute().await.infer_error()?;
|
let table = builder.execute().await.infer_error()?;
|
||||||
Ok(Table::new(table))
|
Ok(Table::new(table))
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "lancedb-node"
|
name = "lancedb-node"
|
||||||
version = "0.4.18"
|
version = "0.4.17"
|
||||||
description = "Serverless, low-latency vector database for AI applications"
|
description = "Serverless, low-latency vector database for AI applications"
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "lancedb"
|
name = "lancedb"
|
||||||
version = "0.4.18"
|
version = "0.4.17"
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
description = "LanceDB: A serverless, low-latency vector database for AI applications"
|
description = "LanceDB: A serverless, low-latency vector database for AI applications"
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
@@ -52,7 +52,7 @@ aws-sdk-kms = { version = "1.0" }
|
|||||||
aws-config = { version = "1.0" }
|
aws-config = { version = "1.0" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = ["remote"]
|
||||||
remote = ["dep:reqwest"]
|
remote = ["dep:reqwest"]
|
||||||
fp16kernels = ["lance-linalg/fp16kernels"]
|
fp16kernels = ["lance-linalg/fp16kernels"]
|
||||||
s3-test = []
|
s3-test = []
|
||||||
@@ -33,9 +33,6 @@ use crate::table::{NativeTable, WriteOptions};
|
|||||||
use crate::utils::validate_table_name;
|
use crate::utils::validate_table_name;
|
||||||
use crate::Table;
|
use crate::Table;
|
||||||
|
|
||||||
#[cfg(feature = "remote")]
|
|
||||||
use log::warn;
|
|
||||||
|
|
||||||
pub const LANCE_FILE_EXTENSION: &str = "lance";
|
pub const LANCE_FILE_EXTENSION: &str = "lance";
|
||||||
|
|
||||||
pub type TableBuilderCallback = Box<dyn FnOnce(OpenTableBuilder) -> OpenTableBuilder + Send>;
|
pub type TableBuilderCallback = Box<dyn FnOnce(OpenTableBuilder) -> OpenTableBuilder + Send>;
|
||||||
@@ -582,7 +579,6 @@ impl ConnectBuilder {
|
|||||||
let api_key = self.api_key.ok_or_else(|| Error::InvalidInput {
|
let api_key = self.api_key.ok_or_else(|| Error::InvalidInput {
|
||||||
message: "An api_key is required when connecting to LanceDb Cloud".to_string(),
|
message: "An api_key is required when connecting to LanceDb Cloud".to_string(),
|
||||||
})?;
|
})?;
|
||||||
warn!("The rust implementation of the remote client is not yet ready for use.");
|
|
||||||
let internal = Arc::new(crate::remote::db::RemoteDatabase::try_new(
|
let internal = Arc::new(crate::remote::db::RemoteDatabase::try_new(
|
||||||
&self.uri,
|
&self.uri,
|
||||||
&api_key,
|
&api_key,
|
||||||
@@ -913,23 +909,12 @@ impl ConnectionInternal for Database {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some ReadParams are exposed in the OpenTableBuilder, but we also
|
|
||||||
// let the user provide their own ReadParams.
|
|
||||||
//
|
|
||||||
// If we have a user provided ReadParams use that
|
|
||||||
// If we don't then start with the default ReadParams and customize it with
|
|
||||||
// the options from the OpenTableBuilder
|
|
||||||
let read_params = options.lance_read_params.unwrap_or_else(|| ReadParams {
|
|
||||||
index_cache_size: options.index_cache_size as usize,
|
|
||||||
..Default::default()
|
|
||||||
});
|
|
||||||
|
|
||||||
let native_table = Arc::new(
|
let native_table = Arc::new(
|
||||||
NativeTable::open_with_params(
|
NativeTable::open_with_params(
|
||||||
&table_uri,
|
&table_uri,
|
||||||
&options.name,
|
&options.name,
|
||||||
self.store_wrapper.clone(),
|
self.store_wrapper.clone(),
|
||||||
Some(read_params),
|
options.lance_read_params,
|
||||||
self.read_consistency_interval,
|
self.read_consistency_interval,
|
||||||
)
|
)
|
||||||
.await?,
|
.await?,
|
||||||
@@ -1047,6 +1032,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[ignore = "this can't pass due to https://github.com/lancedb/lancedb/issues/1019, enable it after the bug fixed"]
|
||||||
async fn test_open_table() {
|
async fn test_open_table() {
|
||||||
let tmp_dir = tempdir().unwrap();
|
let tmp_dir = tempdir().unwrap();
|
||||||
let uri = tmp_dir.path().to_str().unwrap();
|
let uri = tmp_dir.path().to_str().unwrap();
|
||||||
|
|||||||
@@ -46,18 +46,10 @@ impl VectorIndex {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
|
||||||
pub struct VectorIndexMetadata {
|
|
||||||
pub metric_type: String,
|
|
||||||
pub index_type: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
pub struct VectorIndexStatistics {
|
pub struct VectorIndexStatistics {
|
||||||
pub num_indexed_rows: usize,
|
pub num_indexed_rows: usize,
|
||||||
pub num_unindexed_rows: usize,
|
pub num_unindexed_rows: usize,
|
||||||
pub index_type: String,
|
|
||||||
pub indices: Vec<VectorIndexMetadata>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Builder for an IVF PQ index.
|
/// Builder for an IVF PQ index.
|
||||||
|
|||||||
@@ -350,16 +350,8 @@ mod test {
|
|||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_e2e() {
|
async fn test_e2e() {
|
||||||
let dir1 = tempfile::tempdir()
|
let dir1 = tempfile::tempdir().unwrap().into_path();
|
||||||
.unwrap()
|
let dir2 = tempfile::tempdir().unwrap().into_path();
|
||||||
.into_path()
|
|
||||||
.canonicalize()
|
|
||||||
.unwrap();
|
|
||||||
let dir2 = tempfile::tempdir()
|
|
||||||
.unwrap()
|
|
||||||
.into_path()
|
|
||||||
.canonicalize()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let secondary_store = LocalFileSystem::new_with_prefix(dir2.to_str().unwrap()).unwrap();
|
let secondary_store = LocalFileSystem::new_with_prefix(dir2.to_str().unwrap()).unwrap();
|
||||||
let object_store_wrapper = Arc::new(MirroringObjectStoreWrapper {
|
let object_store_wrapper = Arc::new(MirroringObjectStoreWrapper {
|
||||||
|
|||||||
@@ -34,16 +34,6 @@
|
|||||||
//! cargo install lancedb
|
//! cargo install lancedb
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! ## Crate Features
|
|
||||||
//!
|
|
||||||
//! ### Experimental Features
|
|
||||||
//!
|
|
||||||
//! These features are not enabled by default. They are experimental or in-development features that
|
|
||||||
//! are not yet ready to be released.
|
|
||||||
//!
|
|
||||||
//! - `remote` - Enable remote client to connect to LanceDB cloud. This is not yet fully implemented
|
|
||||||
//! and should not be enabled.
|
|
||||||
//!
|
|
||||||
//! ### Quick Start
|
//! ### Quick Start
|
||||||
//!
|
//!
|
||||||
//! #### Connect to a database.
|
//! #### Connect to a database.
|
||||||
|
|||||||
@@ -87,16 +87,14 @@ impl ConnectionInternal for RemoteDatabase {
|
|||||||
.await
|
.await
|
||||||
.unwrap()?;
|
.unwrap()?;
|
||||||
|
|
||||||
let rsp = self
|
self.client
|
||||||
.client
|
.post(&format!("/v1/table/{}/create", options.name))
|
||||||
.post(&format!("/v1/table/{}/create/", options.name))
|
|
||||||
.body(data_buffer)
|
.body(data_buffer)
|
||||||
.header(CONTENT_TYPE, ARROW_STREAM_CONTENT_TYPE)
|
.header(CONTENT_TYPE, ARROW_STREAM_CONTENT_TYPE)
|
||||||
// This is currently expected by LanceDb cloud but will be removed soon.
|
// This is currently expected by LanceDb cloud but will be removed soon.
|
||||||
.header("x-request-id", "na")
|
.header("x-request-id", "na")
|
||||||
.send()
|
.send()
|
||||||
.await?;
|
.await?;
|
||||||
self.client.check_response(rsp).await?;
|
|
||||||
|
|
||||||
Ok(Table::new(Arc::new(RemoteTable::new(
|
Ok(Table::new(Arc::new(RemoteTable::new(
|
||||||
self.client.clone(),
|
self.client.clone(),
|
||||||
|
|||||||
@@ -1061,26 +1061,6 @@ impl NativeTable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_index_type(&self, index_uuid: &str) -> Result<Option<String>> {
|
|
||||||
match self.load_index_stats(index_uuid).await? {
|
|
||||||
Some(stats) => Ok(Some(stats.index_type)),
|
|
||||||
None => Ok(None),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn get_distance_type(&self, index_uuid: &str) -> Result<Option<String>> {
|
|
||||||
match self.load_index_stats(index_uuid).await? {
|
|
||||||
Some(stats) => Ok(Some(
|
|
||||||
stats
|
|
||||||
.indices
|
|
||||||
.iter()
|
|
||||||
.map(|i| i.metric_type.clone())
|
|
||||||
.collect(),
|
|
||||||
)),
|
|
||||||
None => Ok(None),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn load_indices(&self) -> Result<Vec<VectorIndex>> {
|
pub async fn load_indices(&self) -> Result<Vec<VectorIndex>> {
|
||||||
let dataset = self.dataset.get().await?;
|
let dataset = self.dataset.get().await?;
|
||||||
let (indices, mf) = futures::try_join!(dataset.load_indices(), dataset.latest_manifest())?;
|
let (indices, mf) = futures::try_join!(dataset.load_indices(), dataset.latest_manifest())?;
|
||||||
|
|||||||
Reference in New Issue
Block a user