Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions components/databricks/actions/create-endpoint/create-endpoint.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { ConfigurationError } from "@pipedream/platform";
import databricks from "../../databricks.app.mjs";

export default {
key: "databricks-create-endpoint",
name: "Create Endpoint",
description: "Create a new vector search endpoint. [See the documentation](https://docs.databricks.com/api/workspace/vectorsearchendpoints/createendpoint)",
version: "0.0.1",
type: "action",
props: {
databricks,
name: {
type: "string",
label: "Endpoint Name",
description: "The name of the vector search endpoint",
},
},
async run({ $ }) {
try {
const response = await this.databricks.createEndpoint({
data: {
name: this.name,
endpoint_type: "STANDARD",
},
$,
});

if (response) {
$.export("$summary", `Successfully created endpoint with ID ${response.id}.`);
}

return response;
} catch ({ response }) {
throw new ConfigurationError(response.data.message);
}
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "databricks-create-sql-warehouse",
name: "Create SQL Warehouse",
description: "Creates a new SQL Warehouse in Databricks. [See the documentation](https://docs.databricks.com/api/workspace/warehouses/create)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
databricks,
Expand Down
27 changes: 27 additions & 0 deletions components/databricks/actions/delete-endpoint/delete-endpoint.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import databricks from "../../databricks.app.mjs";

export default {
key: "databricks-delete-endpoint",
name: "Delete Endpoint",
description: "Delete a vector search endpoint. [See the documentation](https://docs.databricks.com/api/workspace/vectorsearchendpoints/deleteendpoint)",
version: "0.0.1",
type: "action",
props: {
databricks,
endpointName: {
propDefinition: [
databricks,
"endpointName",
],
},
},
async run({ $ }) {
const response = await this.databricks.deleteEndpoint({
endpointName: this.endpointName,
$,
});

$.export("$summary", `Successfully deleted endpoint "${this.endpointName}".`);
return response;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "databricks-delete-sql-warehouse",
name: "Delete SQL Warehouse",
description: "Deletes a SQL Warehouse by ID. [See the documentation](https://docs.databricks.com/api/workspace/warehouses/delete)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
databricks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "databricks-edit-sql-warehouse",
name: "Edit SQL Warehouse",
description: "Edits the configuration of an existing SQL Warehouse. [See the documentation](https://docs.databricks.com/api/workspace/warehouses/edit)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
databricks,
Expand Down
30 changes: 30 additions & 0 deletions components/databricks/actions/get-endpoint/get-endpoint.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import databricks from "../../databricks.app.mjs";

export default {
key: "databricks-get-endpoint",
name: "Get Endpoint",
description: "Get details of a specific vector search endpoint. [See the documentation](https://docs.databricks.com/api/workspace/vectorsearchendpoints/getendpoint)",
version: "0.0.1",
type: "action",
props: {
databricks,
endpointName: {
propDefinition: [
databricks,
"endpointName",
],
},
},
async run({ $ }) {
const response = await this.databricks.getEndpoint({
endpointName: this.endpointName,
$,
});

if (response) {
$.export("$summary", `Successfully retrieved endpoint "${this.endpointName}".`);
}

return response;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "databricks-get-run-output",
name: "Get Run Output",
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)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
databricks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "databricks-get-sql-warehouse-config",
name: "Get SQL Warehouse Config",
description: "Retrieves the global configuration for SQL Warehouses. [See the documentation](https://docs.databricks.com/api/workspace/warehouses/getworkspacewarehouseconfig)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
databricks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "databricks-get-sql-warehouse-permissions",
name: "Get SQL Warehouse Permissions",
description: "Retrieves the permissions for a specific SQL Warehouse. [See the documentation](https://docs.databricks.com/api/workspace/warehouses/getpermissions)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
databricks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "databricks-get-sql-warehouse",
name: "Get SQL Warehouse",
description: "Retrieves details for a specific SQL Warehouse. [See docs](https://docs.databricks.com/api/workspace/warehouses/get)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
databricks,
Expand Down
45 changes: 45 additions & 0 deletions components/databricks/actions/list-endpoints/list-endpoints.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import databricks from "../../databricks.app.mjs";

export default {
key: "databricks-list-endpoints",
name: "List Endpoints",
description: "List all vector search endpoints. [See the documentation](https://docs.databricks.com/api/workspace/vectorsearchendpoints/listendpoints)",
version: "0.0.1",
type: "action",
props: {
databricks,
maxResults: {
type: "integer",
label: "Max Results",
description: "Maximum number of endpoints to return",
default: 100,
},
},
async run({ $ }) {
const allEndpoints = [];
const params = {};

do {
const {
endpoints, next_page_token,
} = await this.databricks.listEndpoints({
params,
$,
});

allEndpoints.push(...endpoints);
if (!next_page_token) break;
params.page_token = next_page_token;
} while (allEndpoints.length < this.maxResults);

if (allEndpoints.length > this.maxResults) {
allEndpoints.length = this.maxResults;
}

$.export("$summary", `Successfully retrieved ${allEndpoints.length} endpoint${allEndpoints.length === 1
? ""
: "s"}.`);

return allEndpoints;
},
};
2 changes: 1 addition & 1 deletion components/databricks/actions/list-runs/list-runs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "databricks-list-runs",
name: "List Runs",
description: "Lists all runs available to the user. [See the documentation](https://docs.databricks.com/en/workflows/jobs/jobs-2.0-api.html#runs-list)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
databricks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "databricks-list-sql-warehouses",
name: "List SQL Warehouses",
description: "Lists all SQL Warehouses available in the Databricks workspace. [See the documentation](https://docs.databricks.com/api/workspace/warehouses/list)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
databricks,
Expand Down
2 changes: 1 addition & 1 deletion components/databricks/actions/run-job-now/run-job-now.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "databricks-run-job-now",
name: "Run Job Now",
description: "Run a job now and return the id of the triggered run. [See the documentation](https://docs.databricks.com/en/workflows/jobs/jobs-2.0-api.html#runs-list)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
databricks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "databricks-set-sql-warehouse-config",
name: "Set SQL Warehouse Config",
description: "Updates the global configuration for SQL Warehouses. [See the documentation](https://docs.databricks.com/api/workspace/warehouses/setworkspacewarehouseconfig)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
databricks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "databricks-set-sql-warehouse-permissions",
name: "Set SQL Warehouse Permissions",
description: "Updates the permissions for a specific SQL Warehouse. [See docs](https://docs.databricks.com/api/workspace/warehouses/setpermissions)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
databricks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "databricks-start-sql-warehouse",
name: "Start SQL Warehouse",
description: "Starts a SQL Warehouse by ID. [See the documentation](https://docs.databricks.com/api/workspace/warehouses/start)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
databricks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "databricks-stop-sql-warehouse",
name: "Stop SQL Warehouse",
description: "Stops a SQL Warehouse by ID. [See the documentation](https://docs.databricks.com/api/workspace/warehouses/stop)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
databricks,
Expand Down
52 changes: 52 additions & 0 deletions components/databricks/databricks.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,27 @@ export default {
})) || [];
},
},
endpointName: {
type: "string",
label: "Endpoint Name",
description: "The name of the vector search endpoint",
async options({ prevContext }) {
const {
endpoints, next_page_token,
} = await this.listEndpoints({
params: {
page_token: prevContext.page_token,
},
});

return {
options: endpoints.map(({ name }) => name),
context: {
page_token: next_page_token,
},
};
},
},
warehouseId: {
type: "string",
label: "Warehouse ID",
Expand All @@ -61,6 +82,7 @@ export default {
},
},
methods: {

_baseUrl() {
return `https://${this.$auth.domain}.cloud.databricks.com/api/2.0`;
},
Expand Down Expand Up @@ -105,13 +127,43 @@ export default {
...args,
});
},
createEndpoint(args = {}) {
return this._makeRequest({
path: "/vector-search/endpoints",
method: "POST",
...args,
});
},
createSQLWarehouse(args = {}) {
return this._makeRequest({
path: "/sql/warehouses",
method: "POST",
...args,
});
},
getEndpoint({
endpointName, ...opts
}) {
return this._makeRequest({
path: `/vector-search/endpoints/${endpointName}`,
...opts,
});
},
listEndpoints(args = {}) {
return this._makeRequest({
path: "/vector-search/endpoints",
...args,
});
},
deleteEndpoint({
endpointName, ...opts
}) {
return this._makeRequest({
path: `/vector-search/endpoints/${endpointName}`,
method: "DELETE",
...opts,
});
},
deleteSQLWarehouse({
warehouseId, ...args
}) {
Expand Down
4 changes: 2 additions & 2 deletions components/databricks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/databricks",
"version": "0.2.0",
"version": "0.3.0",
"description": "Pipedream Databricks Components",
"main": "databricks.app.mjs",
"keywords": [
Expand All @@ -13,6 +13,6 @@
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^1.5.1"
"@pipedream/platform": "^3.1.0"
}
}
Loading
Loading