Skip to content

Commit 75214fc

Browse files
committed
updated
1 parent ebea510 commit 75214fc

File tree

3 files changed

+26
-34
lines changed

3 files changed

+26
-34
lines changed

components/databricks/actions/delete-vector-search-index-data/delete-vector-search-index-data.mjs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import databricks from "../../databricks.app.mjs";
2+
import utils from "../../common/utils.mjs";
23

34
export default {
45
key: "databricks-delete-vector-search-index-data",
@@ -23,7 +24,13 @@ export default {
2324
},
2425
},
2526
async run({ $ }) {
26-
const keys = (this.primaryKeys || [])
27+
const parsedKeys = utils.parseObject(this.primaryKeys);
28+
29+
const keys = (Array.isArray(parsedKeys)
30+
? parsedKeys
31+
: [
32+
parsedKeys,
33+
])
2734
.map((s) => String(s).trim())
2835
.filter(Boolean);
2936

@@ -33,7 +40,7 @@ export default {
3340

3441
const response = await this.databricks.deleteVectorSearchData({
3542
indexName: this.indexName,
36-
data: {
43+
params: {
3744
primary_keys: keys,
3845
},
3946
$,

components/databricks/actions/list-vector-search-indexes/list-vector-search-indexes.mjs

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import databricks from "../../databricks.app.mjs";
33
export default {
44
key: "databricks-list-vector-search-indexes",
55
name: "List Vector Search Indexes",
6-
description: "Lists all vector search indexes in the workspace. [See the documentation](https://docs.databricks.com/api/workspace/vectorsearchindexes/listindexes)",
6+
description: "Lists all vector search indexes for a given endpoint. [See the documentation](https://docs.databricks.com/api/workspace/vectorsearchindexes/listindexes)",
77
version: "0.0.1",
88
type: "action",
99
props: {
@@ -17,38 +17,20 @@ export default {
1717
},
1818

1919
async run({ $ }) {
20-
const allIndexes = [];
21-
let pageToken;
22-
23-
do {
24-
const {
25-
vector_indexes, next_page_token,
26-
} = await this.databricks.listVectorSearchIndexes({
27-
params: {
28-
endpoint_name: this.endpointName,
29-
...(pageToken
30-
? {
31-
page_token: pageToken,
32-
}
33-
: {}),
34-
},
35-
$,
36-
});
37-
38-
if (vector_indexes?.length) {
39-
allIndexes.push(...vector_indexes);
40-
}
41-
42-
pageToken = next_page_token;
43-
} while (pageToken);
20+
const { vector_indexes = [] } = await this.databricks.listVectorSearchIndexes({
21+
params: {
22+
endpoint_name: this.endpointName,
23+
},
24+
$,
25+
});
4426

4527
$.export(
4628
"$summary",
47-
`Successfully retrieved ${allIndexes.length} index${allIndexes.length === 1
29+
`Successfully retrieved ${vector_indexes.length} index${vector_indexes.length === 1
4830
? ""
4931
: "es"}.`,
5032
);
5133

52-
return allIndexes;
34+
return vector_indexes;
5335
},
5436
};

components/databricks/databricks.app.mjs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,11 @@ export default {
281281
});
282282
},
283283

284-
listVectorSearchIndexes(args = {}) {
284+
listVectorSearchIndexes({
285+
params, ...args
286+
}) {
285287
return this._makeRequest({
286-
path: "/vector-search/indexes",
288+
path: `/vector-search/indexes?endpoint_name=${params.endpoint_name}`,
287289
method: "GET",
288290
...args,
289291
});
@@ -320,10 +322,11 @@ export default {
320322
},
321323

322324
deleteVectorSearchData({
323-
indexName, ...args
324-
}) {
325+
indexName, params, ...args
326+
})
327+
{
325328
return this._makeRequest({
326-
path: `/vector-search/indexes/${indexName}/delete-data`,
329+
path: `/vector-search/indexes/${indexName}/delete-data?primary_keys=${params.primary_keys}`,
327330
method: "DELETE",
328331
...args,
329332
});

0 commit comments

Comments
 (0)