Skip to content

Commit 62287c7

Browse files
committed
Added Vector Search Index API actions
Summary This PR adds support for Databricks Vector Search Index APIs by implementing 9 new actions. Changes - Added create index action - Added get index action - Added list indexes action - Added delete index action - Added query index action - Added sync index action - Added scan index action - Added upsert index data action - Added delete index data action Resolves #18126
1 parent 99dfc76 commit 62287c7

File tree

25 files changed

+577
-15
lines changed

25 files changed

+577
-15
lines changed

components/databricks/actions/create-sql-warehouse/create-sql-warehouse.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
key: "databricks-create-sql-warehouse",
88
name: "Create SQL Warehouse",
99
description: "Creates a new SQL Warehouse in Databricks. [See the documentation](https://docs.databricks.com/api/workspace/warehouses/create)",
10-
version: "0.0.1",
10+
version: "0.0.3",
1111
type: "action",
1212
props: {
1313
databricks,
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
import databricks from "../../databricks.app.mjs";
2+
import utils from "../../common/utils.mjs";
3+
import { ConfigurationError } from "@pipedream/platform";
4+
5+
export default {
6+
key: "databricks-create-vector-search-index",
7+
name: "Create Vector Search Index",
8+
description:
9+
"Creates a new vector search index in Databricks. [See the documentation](https://docs.databricks.com/api/workspace/vectorsearchindexes/createindex)",
10+
version: "0.0.1",
11+
type: "action",
12+
props: {
13+
databricks,
14+
name: {
15+
type: "string",
16+
label: "Index Name",
17+
description:
18+
"A unique name for the index (e.g., `main_catalog.docs.en_wiki_index`).",
19+
},
20+
endpointName: {
21+
type: "string",
22+
label: "Endpoint Name",
23+
description: "The vector search endpoint that will serve the index.",
24+
},
25+
indexType: {
26+
type: "string",
27+
label: "Index Type",
28+
description: "Type of index (`DELTA_SYNC` or `DIRECT_ACCESS`).",
29+
options: ["DELTA_SYNC", "DIRECT_ACCESS"],
30+
},
31+
primaryKey: {
32+
type: "string",
33+
label: "Primary Key",
34+
description: "The primary key column for the index.",
35+
},
36+
sourceTable: {
37+
type: "string",
38+
label: "Source Table",
39+
description:
40+
"The Delta table backing the index (required if `indexType` is `DELTA_SYNC`).",
41+
optional: true,
42+
},
43+
columnsToSync: {
44+
type: "string[]",
45+
label: "Columns to Sync",
46+
description:
47+
"List of columns to sync from the source Delta table. Example: `[\"id\", \"text\"]`",
48+
optional: true,
49+
},
50+
embeddingSourceColumns: {
51+
type: "string[]",
52+
label: "Embedding Source Columns",
53+
description:
54+
"List of embedding source column configs. Each entry should be a JSON object string like `{ \"embedding_model_endpoint_name\": \"e5-small-v2\", \"name\": \"text\" }`",
55+
optional: true,
56+
},
57+
pipelineType: {
58+
type: "string",
59+
label: "Pipeline Type",
60+
description: "Pipeline type for syncing (default: TRIGGERED).",
61+
options: ["TRIGGERED", "CONTINUOUS"],
62+
optional: true,
63+
default: "TRIGGERED",
64+
},
65+
},
66+
67+
async run({ $ }) {
68+
const payload = {
69+
name: this.name,
70+
endpoint_name: this.endpointName,
71+
index_type: this.indexType,
72+
primary_key: this.primaryKey,
73+
};
74+
75+
if (this.indexType === "DELTA_SYNC") {
76+
if (!this.sourceTable) {
77+
throw new ConfigurationError(
78+
"sourceTable is required when indexType is DELTA_SYNC."
79+
);
80+
}
81+
82+
const columnsToSync = utils.parseObject(this.columnsToSync);
83+
const embeddingSourceColumns = utils.parseObject(
84+
this.embeddingSourceColumns
85+
);
86+
87+
if (!Array.isArray(columnsToSync) || !columnsToSync.length) {
88+
throw new ConfigurationError(
89+
"columnsToSync must be a non-empty array for DELTA_SYNC indexes."
90+
);
91+
}
92+
if (
93+
!Array.isArray(embeddingSourceColumns) ||
94+
!embeddingSourceColumns.length
95+
) {
96+
throw new ConfigurationError(
97+
"embeddingSourceColumns must be a non-empty array for DELTA_SYNC indexes."
98+
);
99+
}
100+
101+
payload.delta_sync_index_spec = {
102+
source_table: this.sourceTable,
103+
pipeline_type: this.pipelineType || "TRIGGERED",
104+
columns_to_sync: columnsToSync,
105+
embedding_source_columns: embeddingSourceColumns,
106+
};
107+
}
108+
109+
const response = await this.databricks.createVectorSearchIndex({
110+
data: payload,
111+
$,
112+
});
113+
114+
$.export(
115+
"$summary",
116+
`Successfully created vector search index: ${response?.name || this.name}`
117+
);
118+
return response;
119+
},
120+
};

components/databricks/actions/delete-sql-warehouse/delete-sql-warehouse.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "databricks-delete-sql-warehouse",
55
name: "Delete SQL Warehouse",
66
description: "Deletes a SQL Warehouse by ID. [See the documentation](https://docs.databricks.com/api/workspace/warehouses/delete)",
7-
version: "0.0.1",
7+
version: "0.0.3",
88
type: "action",
99
props: {
1010
databricks,
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import databricks from "../../databricks.app.mjs";
2+
3+
export default {
4+
key: "databricks-delete-data-from-vector-index",
5+
name: "Delete Data from Vector Search Index",
6+
description:
7+
"Deletes rows from a Direct Access vector index by primary-key values. [See the documentation](https://docs.databricks.com/api/workspace/vectorsearchindexes/deletedatavectorindex)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
databricks,
12+
indexName: {
13+
propDefinition: [
14+
databricks,
15+
"indexName",
16+
],
17+
},
18+
primaryKeys: {
19+
type: "string[]",
20+
label: "Primary Keys",
21+
description:
22+
"Values of the index’s primary key column to delete (e.g. `1`, `2`). These are the values for the column you set as `primary_key` when the index was created.",
23+
},
24+
},
25+
async run({ $ }) {
26+
const keys = (this.primaryKeys || [])
27+
.map((s) => String(s).trim())
28+
.filter(Boolean);
29+
30+
if (!keys.length) {
31+
throw new Error("Please provide at least one primary key to delete.");
32+
}
33+
34+
const response = await this.databricks.deleteVectorSearchData({
35+
indexName: this.indexName,
36+
params: { primary_keys: keys },
37+
$,
38+
});
39+
40+
$.export(
41+
"$summary",
42+
`Requested delete of ${keys.length} row(s) from index "${this.indexName}".`,
43+
);
44+
return response;
45+
},
46+
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import databricks from "../../databricks.app.mjs";
2+
3+
export default {
4+
key: "databricks-delete-vector-search-index",
5+
name: "Delete Vector Search Index",
6+
description: "Deletes a vector search index in Databricks. [See the documentation](https://docs.databricks.com/api/workspace/vectorsearchindexes/deleteindex)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
databricks,
11+
indexName: {
12+
propDefinition: [
13+
databricks,
14+
"indexName",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
const response = await this.databricks.deleteVectorSearchIndex({
20+
indexName: this.indexName,
21+
$,
22+
});
23+
24+
$.export("$summary", `Successfully deleted vector search index: ${this.indexName}`);
25+
return response;
26+
},
27+
};

components/databricks/actions/edit-sql-warehouse/edit-sql-warehouse.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
key: "databricks-edit-sql-warehouse",
88
name: "Edit SQL Warehouse",
99
description: "Edits the configuration of an existing SQL Warehouse. [See the documentation](https://docs.databricks.com/api/workspace/warehouses/edit)",
10-
version: "0.0.1",
10+
version: "0.0.3",
1111
type: "action",
1212
props: {
1313
databricks,

components/databricks/actions/get-run-output/get-run-output.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "databricks-get-run-output",
55
name: "Get Run Output",
66
description: "Retrieve the output and metadata of a single task run. [See the documentation](https://docs.databricks.com/en/workflows/jobs/jobs-2.0-api.html#runs-get-output)",
7-
version: "0.0.2",
7+
version: "0.0.4",
88
type: "action",
99
props: {
1010
databricks,

components/databricks/actions/get-sql-warehouse-config/get-sql-warehouse-config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "databricks-get-sql-warehouse-config",
55
name: "Get SQL Warehouse Config",
66
description: "Retrieves the global configuration for SQL Warehouses. [See the documentation](https://docs.databricks.com/api/workspace/warehouses/getworkspacewarehouseconfig)",
7-
version: "0.0.1",
7+
version: "0.0.3",
88
type: "action",
99
props: {
1010
databricks,

components/databricks/actions/get-sql-warehouse-permissions/get-sql-warehouse-permissions.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "databricks-get-sql-warehouse-permissions",
55
name: "Get SQL Warehouse Permissions",
66
description: "Retrieves the permissions for a specific SQL Warehouse. [See the documentation](https://docs.databricks.com/api/workspace/warehouses/getpermissions)",
7-
version: "0.0.1",
7+
version: "0.0.3",
88
type: "action",
99
props: {
1010
databricks,

components/databricks/actions/get-sql-warehouse/get-sql-warehouse.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "databricks-get-sql-warehouse",
55
name: "Get SQL Warehouse",
66
description: "Retrieves details for a specific SQL Warehouse. [See docs](https://docs.databricks.com/api/workspace/warehouses/get)",
7-
version: "0.0.1",
7+
version: "0.0.3",
88
type: "action",
99
props: {
1010
databricks,

0 commit comments

Comments
 (0)