mirror of
https://github.com/lancedb/lancedb.git
synced 2026-01-13 23:32:57 +00:00
fix(node): pass AWS credentials to db level operations (#908)
Passed the following tests
```ts
const keyId = process.env.AWS_ACCESS_KEY_ID;
const secretKey = process.env.AWS_SECRET_ACCESS_KEY;
const sessionToken = process.env.AWS_SESSION_TOKEN;
const region = process.env.AWS_REGION;
const db = await lancedb.connect({
uri: "s3://bucket/path",
awsCredentials: {
accessKeyId: keyId,
secretKey: secretKey,
sessionToken: sessionToken,
},
awsRegion: region,
} as lancedb.ConnectionOptions);
console.log(await db.createTable("test", [{ vector: [1, 2, 3] }]));
console.log(await db.tableNames());
console.log(await db.dropTable("test"))
```
This commit is contained in:
@@ -163,6 +163,7 @@ export async function connect (
|
||||
{
|
||||
uri: '',
|
||||
awsCredentials: undefined,
|
||||
awsRegion: defaultAwsRegion,
|
||||
apiKey: undefined,
|
||||
region: defaultAwsRegion
|
||||
},
|
||||
@@ -174,7 +175,13 @@ export async function connect (
|
||||
// Remote connection
|
||||
return new RemoteConnection(opts)
|
||||
}
|
||||
const db = await databaseNew(opts.uri)
|
||||
const db = await databaseNew(
|
||||
opts.uri,
|
||||
opts.awsCredentials?.accessKeyId,
|
||||
opts.awsCredentials?.secretKey,
|
||||
opts.awsCredentials?.sessionToken,
|
||||
opts.awsRegion
|
||||
)
|
||||
return new LocalConnection(db, opts)
|
||||
}
|
||||
|
||||
@@ -443,7 +450,7 @@ export interface Table<T = number[]> {
|
||||
*/
|
||||
indexStats: (indexUuid: string) => Promise<IndexStats>
|
||||
|
||||
filter (value: string): Query<T>
|
||||
filter(value: string): Query<T>
|
||||
|
||||
schema: Promise<Schema>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user