Upgrade lance and pass AWS creds when opening a table (#426)

This commit is contained in:
Rob Meng
2023-08-14 18:22:02 -04:00
committed by GitHub
parent b281c5255c
commit f0bcb26f32
2 changed files with 11 additions and 3 deletions

View File

@@ -256,7 +256,16 @@ export class LocalConnection implements Connection {
async openTable<T> (name: string, embeddings: EmbeddingFunction<T>): Promise<Table<T>>
async openTable<T> (name: string, embeddings?: EmbeddingFunction<T>): Promise<Table<T>>
async openTable<T> (name: string, embeddings?: EmbeddingFunction<T>): Promise<Table<T>> {
const tbl = await databaseOpenTable.call(this._db, name)
// TODO: move this thing into rust
const callArgs = [this._db, name]
if (this._options.awsCredentials !== undefined) {
callArgs.push(this._options.awsCredentials.accessKeyId)
callArgs.push(this._options.awsCredentials.secretKey)
if (this._options.awsCredentials.sessionToken !== undefined) {
callArgs.push(this._options.awsCredentials.sessionToken)
}
}
const tbl = await databaseOpenTable.call(...callArgs)
if (embeddings !== undefined) {
return new LocalTable(tbl, name, this._options, embeddings)
} else {