-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Added Databricks SQL Warehouses API actions #18148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
97b92e1
5a697bd
6623be2
8343661
9292e93
6a9646c
d66788b
e120588
5238430
e742ec2
01ed509
d83d206
49e997c
0535802
b98476c
2153ac3
b04a050
2222816
2aeacf2
9bfe023
99dfc76
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import databricks from "../../databricks.app.mjs"; | ||
|
|
||
| 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", | ||
| type: "action", | ||
| props: { | ||
| databricks, | ||
| name: { | ||
| type: "string", | ||
| label: "Warehouse Name", | ||
| description: "A human-readable name for the warehouse", | ||
| }, | ||
| clusterSize: { | ||
| type: "string", | ||
| label: "Cluster Size", | ||
| description: "Size of the cluster (e.g., `Small`, `Medium`, `Large`)", | ||
| }, | ||
| autoStopMinutes: { | ||
| type: "integer", | ||
| label: "Auto Stop (minutes)", | ||
| description: "Number of minutes of inactivity before the warehouse auto-stops", | ||
| optional: true, | ||
| default: 10, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const payload = { | ||
| name: this.name, | ||
| cluster_size: this.clusterSize, | ||
| auto_stop_mins: this.autoStopMinutes, | ||
| }; | ||
|
|
||
| const response = await this.databricks.createSQLWarehouse({ | ||
| data: payload, | ||
| $, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully created SQL Warehouse: ${response?.name || this.name}`); | ||
| return response; | ||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import databricks from "../../databricks.app.mjs"; | ||
|
|
||
| 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", | ||
| type: "action", | ||
| props: { | ||
| databricks, | ||
| warehouseId: { | ||
| type: "string", | ||
| label: "Warehouse ID", | ||
| description: "The ID of the SQL Warehouse to delete", | ||
| }, | ||
Lokeshchand33 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| async run({ $ }) { | ||
| await this.databricks.deleteSQLWarehouse({ | ||
| warehouseId: this.warehouseId, | ||
| $, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully deleted SQL Warehouse with ID ${this.warehouseId}`); | ||
| return { success: true }; | ||
|
Check failure on line 24 in components/databricks/actions/delete-sql-warehouse/delete-sql-warehouse.mjs
|
||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import databricks from "../../databricks.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "databricks-edit-sql-warehouse", | ||
| name: "Edit SQL Warehouse", | ||
| description: "Edits the configuration of an existing SQL Warehouse. [See docs](https://docs.databricks.com/api/workspace/warehouses/edit)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| databricks, | ||
| warehouseId: { | ||
| type: "string", | ||
| label: "Warehouse ID", | ||
| description: "The ID of the SQL Warehouse to edit", | ||
| }, | ||
Lokeshchand33 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| body: { | ||
| type: "object", | ||
| label: "Edit Configuration", | ||
| description: "The new configuration for the SQL Warehouse (JSON object). Example: `{ \"name\": \"Updated Warehouse\", \"cluster_size\": \"2X-Small\" }`", | ||
| }, | ||
Lokeshchand33 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.databricks.editSQLWarehouse({ | ||
| warehouseId: this.warehouseId, | ||
| data: this.body, | ||
| $, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully edited SQL Warehouse ID ${this.warehouseId}`); | ||
| return response; | ||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import databricks from "../../databricks.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "databricks-get-sql-warehouse-config", | ||
| name: "Get SQL Warehouse Config", | ||
| description: "Retrieves the global configuration for SQL Warehouses. [See docs](https://docs.databricks.com/api/workspace/warehouses/getworkspacewarehouseconfig)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| databricks, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.databricks.getSQLWarehouseConfig({ $ }); | ||
|
Check failure on line 13 in components/databricks/actions/get-sql-warehouse-config/get-sql-warehouse-config.mjs
|
||
| $.export("$summary", "Successfully retrieved SQL Warehouse configuration"); | ||
| return response; | ||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import databricks from "../../databricks.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "databricks-get-sql-warehouse-permissions", | ||
| name: "Get SQL Warehouse Permissions", | ||
| description: "Retrieves the permissions for a specific SQL Warehouse. [See docs](https://docs.databricks.com/api/workspace/warehouses/getpermissions)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| databricks, | ||
| warehouseId: { | ||
| type: "string", | ||
| label: "Warehouse ID", | ||
| description: "The ID of the SQL Warehouse to fetch permissions for", | ||
| }, | ||
Lokeshchand33 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.databricks.getSQLWarehousePermissions({ | ||
| warehouseId: this.warehouseId, | ||
| $, | ||
| }); | ||
|
|
||
| $.export("$summary", `Retrieved permissions for SQL Warehouse ID ${this.warehouseId}`); | ||
| return response; | ||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import databricks from "../../databricks.app.mjs"; | ||
|
|
||
| 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", | ||
| type: "action", | ||
| props: { | ||
| databricks, | ||
| warehouseId: { | ||
| type: "string", | ||
| label: "Warehouse ID", | ||
| description: "The ID of the SQL Warehouse to retrieve", | ||
| }, | ||
Lokeshchand33 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.databricks.getSQLWarehouse({ | ||
| warehouseId: this.warehouseId, | ||
| $, | ||
| }); | ||
|
|
||
| $.export("$summary", `Retrieved details for SQL Warehouse ID ${this.warehouseId}`); | ||
| return response; | ||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import databricks from "../../databricks.app.mjs"; | ||
|
|
||
| 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", | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| type: "action", | ||
| props: { | ||
| databricks, | ||
| maxResults: { | ||
| type: "integer", | ||
| label: "Max Results", | ||
| description: "Maximum number of warehouses to return", | ||
| default: 50, | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const params = { | ||
| limit: this.maxResults || 50, | ||
| }; | ||
|
|
||
| const { warehouses } = await this.databricks.listSQLWarehouses({ | ||
| params, | ||
| $, | ||
| }); | ||
Lokeshchand33 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| if (!warehouses?.length) { | ||
| $.export("$summary", "No warehouses found."); | ||
| return []; | ||
| } | ||
|
|
||
| $.export("$summary", `Successfully retrieved ${warehouses.length} warehouse${warehouses.length === 1 ? "" : "s"}.`); | ||
|
Check failure on line 34 in components/databricks/actions/list-sql-warehouses/list-sql-warehouses.mjs
|
||
|
|
||
| return warehouses; | ||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import databricks from "../../databricks.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "databricks-set-sql-warehouse-config", | ||
| name: "Set SQL Warehouse Config", | ||
| description: "Updates the global configuration for SQL Warehouses. [See docs](https://docs.databricks.com/api/workspace/warehouses/setworkspacewarehouseconfig)", | ||
| version: "0.0.1", | ||
Lokeshchand33 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| type: "action", | ||
| props: { | ||
| databricks, | ||
| config: { | ||
| type: "object", | ||
| label: "Configuration", | ||
| description: "The configuration object for SQL Warehouses. Example: `{ \"enable_serverless_compute\": true }`", | ||
| }, | ||
| }, | ||
Lokeshchand33 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| async run({ $ }) { | ||
| const response = await this.databricks.setSQLWarehouseConfig({ | ||
| data: this.config, | ||
| $, | ||
| }); | ||
|
|
||
| $.export("$summary", "Successfully updated SQL Warehouse configuration"); | ||
| return response; | ||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import databricks from "../../databricks.app.mjs"; | ||
|
|
||
| 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", | ||
| type: "action", | ||
| props: { | ||
| databricks, | ||
| warehouseId: { | ||
| type: "string", | ||
| label: "Warehouse ID", | ||
| description: "The ID of the SQL Warehouse to update permissions for", | ||
| }, | ||
Lokeshchand33 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| accessControlList: { | ||
| type: "object[]", | ||
| label: "Access Control List", | ||
| description: "List of access control entries. Each entry must include one of `user_name`, `group_name`, or `service_principal_name`, and a `permission_level` (`CAN_VIEW`, `CAN_MONITOR`, `CAN_USE`, `CAN_MANAGE`).", | ||
Lokeshchand33 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| properties: { | ||
| user_name: { type: "string", optional: true }, | ||
|
Check failure on line 21 in components/databricks/actions/set-sql-warehouse-permissions/set-sql-warehouse-permissions.mjs
|
||
| group_name: { type: "string", optional: true }, | ||
| service_principal_name: { type: "string", optional: true }, | ||
| permission_level: { | ||
| type: "string", | ||
| options: ["CAN_VIEW", "CAN_MONITOR", "CAN_USE", "CAN_MANAGE"] | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| async run({ $ }) { | ||
| const response = await this.databricks.setSQLWarehousePermissions({ | ||
| warehouseId: this.warehouseId, | ||
| data: { | ||
| access_control_list: this.accessControlList, | ||
| }, | ||
| $, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully updated permissions for SQL Warehouse ID ${this.warehouseId}`); | ||
| return response; | ||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import databricks from "../../databricks.app.mjs"; | ||
|
|
||
| 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", | ||
| type: "action", | ||
| props: { | ||
| databricks, | ||
| warehouseId: { | ||
| type: "string", | ||
| label: "Warehouse ID", | ||
| description: "The ID of the SQL Warehouse to start", | ||
| }, | ||
Lokeshchand33 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.databricks.startSQLWarehouse({ | ||
| warehouseId: this.warehouseId, | ||
| $, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully started SQL Warehouse with ID ${this.warehouseId}`); | ||
| return response; | ||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import databricks from "../../databricks.app.mjs"; | ||
|
|
||
| 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", | ||
| type: "action", | ||
| props: { | ||
| databricks, | ||
| warehouseId: { | ||
| type: "string", | ||
| label: "Warehouse ID", | ||
| description: "The ID of the SQL Warehouse to stop", | ||
| }, | ||
Lokeshchand33 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.databricks.stopSQLWarehouse({ | ||
| warehouseId: this.warehouseId, | ||
| $, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully stopped SQL Warehouse with ID ${this.warehouseId}`); | ||
| return response; | ||
| }, | ||
| }; | ||
Uh oh!
There was an error while loading. Please reload this page.