warehouses
Creates, updates, deletes, gets or lists a warehouses resource.
Overview
| Name | warehouses |
| Type | Resource |
| Id | databricks_workspace.sql.warehouses |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
id | string | unique identifier for warehouse |
name | string | Logical name for the cluster. Supported values: - Must be unique within an org. - Must be less than 100 characters. |
creator_name | string | warehouse creator name |
auto_stop_mins | integer | |
channel | object | Channel Details |
cluster_size | string | Size of the clusters allocated for this warehouse. Increasing the size of a spark cluster allows you to run larger queries on it. If you want to increase the number of concurrent queries, please tune max_num_clusters. Supported values: - 2X-Small - X-Small - Small - Medium - Large - X-Large - 2X-Large - 3X-Large - 4X-Large - 5X-Large |
enable_photon | boolean | Configures whether the warehouse should use Photon optimized clusters. Defaults to true. |
enable_serverless_compute | boolean | Configures whether the warehouse should use serverless compute |
health | object | Optional health status. Assume the warehouse is healthy if this field is not set. |
instance_profile_arn | string | Deprecated. Instance profile used to pass IAM role to the cluster |
jdbc_url | string | the jdbc connection string for this warehouse |
max_num_clusters | integer | Maximum number of clusters that the autoscaler will create to handle concurrent queries. Supported values: - Must be >= min_num_clusters - Must be <= 40. Defaults to min_clusters if unset. |
min_num_clusters | integer | Minimum number of available clusters that will be maintained for this SQL warehouse. Increasing this will ensure that a larger number of clusters are always running and therefore may reduce the cold start time for new queries. This is similar to reserved vs. revocable cores in a resource manager. Supported values: - Must be > 0 - Must be <= min(max_num_clusters, 30) Defaults to 1 |
num_active_sessions | integer | Deprecated. current number of active sessions for the warehouse |
num_clusters | integer | current number of clusters running for the service |
odbc_params | object | ODBC parameters for the SQL warehouse |
spot_instance_policy | string | Configurations whether the endpoint should use spot instances. (COST_OPTIMIZED, POLICY_UNSPECIFIED, RELIABILITY_OPTIMIZED) |
state | string | state of the endpoint (DELETED, DELETING, RUNNING, STARTING, STOPPED, STOPPING) |
tags | object | A set of key-value pairs that will be tagged on all resources (e.g., AWS instances and EBS volumes) associated with this SQL warehouse. Supported values: - Number of tags < 45. |
warehouse_type | string | Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless compute, you must set to `PRO` and also set the field `enable_serverless_compute` to `true`. (CLASSIC, PRO, TYPE_UNSPECIFIED) |
| Name | Datatype | Description |
|---|---|---|
id | string | unique identifier for warehouse |
name | string | Logical name for the cluster. Supported values: - Must be unique within an org. - Must be less than 100 characters. |
creator_name | string | warehouse creator name |
auto_stop_mins | integer | |
channel | object | Channel Details |
cluster_size | string | Size of the clusters allocated for this warehouse. Increasing the size of a spark cluster allows you to run larger queries on it. If you want to increase the number of concurrent queries, please tune max_num_clusters. Supported values: - 2X-Small - X-Small - Small - Medium - Large - X-Large - 2X-Large - 3X-Large - 4X-Large - 5X-Large |
enable_photon | boolean | Configures whether the warehouse should use Photon optimized clusters. Defaults to true. |
enable_serverless_compute | boolean | Configures whether the warehouse should use serverless compute |
health | object | Optional health status. Assume the warehouse is healthy if this field is not set. |
instance_profile_arn | string | Deprecated. Instance profile used to pass IAM role to the cluster |
jdbc_url | string | the jdbc connection string for this warehouse |
max_num_clusters | integer | Maximum number of clusters that the autoscaler will create to handle concurrent queries. Supported values: - Must be >= min_num_clusters - Must be <= 40. Defaults to min_clusters if unset. |
min_num_clusters | integer | Minimum number of available clusters that will be maintained for this SQL warehouse. Increasing this will ensure that a larger number of clusters are always running and therefore may reduce the cold start time for new queries. This is similar to reserved vs. revocable cores in a resource manager. Supported values: - Must be > 0 - Must be <= min(max_num_clusters, 30) Defaults to 1 |
num_active_sessions | integer | Deprecated. current number of active sessions for the warehouse |
num_clusters | integer | current number of clusters running for the service |
odbc_params | object | ODBC parameters for the SQL warehouse |
spot_instance_policy | string | Configurations whether the endpoint should use spot instances. (COST_OPTIMIZED, POLICY_UNSPECIFIED, RELIABILITY_OPTIMIZED) |
state | string | state of the endpoint (DELETED, DELETING, RUNNING, STARTING, STOPPED, STOPPING) |
tags | object | A set of key-value pairs that will be tagged on all resources (e.g., AWS instances and EBS volumes) associated with this SQL warehouse. Supported values: - Number of tags < 45. |
warehouse_type | string | Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless compute, you must set to `PRO` and also set the field `enable_serverless_compute` to `true`. (CLASSIC, PRO, TYPE_UNSPECIFIED) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | id, deployment_name | Gets the information for a single SQL warehouse. | |
list | select | deployment_name | page_size, page_token, run_as_user_id | Lists all SQL warehouses that a user has access to. |
create | insert | deployment_name | Creates a new SQL warehouse. | |
edit | replace | id, deployment_name | Updates the configuration for a SQL warehouse. | |
delete | delete | id, deployment_name | Deletes a SQL warehouse. | |
start | exec | id, deployment_name | Starts a SQL warehouse. | |
stop | exec | id, deployment_name | Stops a SQL warehouse. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
deployment_name | string | The Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc) |
id | string | Required. Id of the SQL warehouse. |
page_size | integer | The max number of warehouses to return. |
page_token | string | A page token, received from a previous ListWarehouses call. Provide this to retrieve the subsequent page; otherwise the first will be retrieved. When paginating, all other parameters provided to ListWarehouses must match the call that provided the page token. |
run_as_user_id | integer | Deprecated: this field is ignored by the server. Service Principal which will be used to fetch the list of endpoints. If not specified, SQL Gateway will use the user from the session header. |
SELECT examples
- get
- list
Gets the information for a single SQL warehouse.
SELECT
id,
name,
creator_name,
auto_stop_mins,
channel,
cluster_size,
enable_photon,
enable_serverless_compute,
health,
instance_profile_arn,
jdbc_url,
max_num_clusters,
min_num_clusters,
num_active_sessions,
num_clusters,
odbc_params,
spot_instance_policy,
state,
tags,
warehouse_type
FROM databricks_workspace.sql.warehouses
WHERE id = '{{ id }}' -- required
AND deployment_name = '{{ deployment_name }}' -- required
;
Lists all SQL warehouses that a user has access to.
SELECT
id,
name,
creator_name,
auto_stop_mins,
channel,
cluster_size,
enable_photon,
enable_serverless_compute,
health,
instance_profile_arn,
jdbc_url,
max_num_clusters,
min_num_clusters,
num_active_sessions,
num_clusters,
odbc_params,
spot_instance_policy,
state,
tags,
warehouse_type
FROM databricks_workspace.sql.warehouses
WHERE deployment_name = '{{ deployment_name }}' -- required
AND page_size = '{{ page_size }}'
AND page_token = '{{ page_token }}'
AND run_as_user_id = '{{ run_as_user_id }}'
;
INSERT examples
- create
- Manifest
Creates a new SQL warehouse.
INSERT INTO databricks_workspace.sql.warehouses (
auto_stop_mins,
channel,
cluster_size,
creator_name,
enable_photon,
enable_serverless_compute,
instance_profile_arn,
max_num_clusters,
min_num_clusters,
name,
spot_instance_policy,
tags,
warehouse_type,
deployment_name
)
SELECT
{{ auto_stop_mins }},
'{{ channel }}',
'{{ cluster_size }}',
'{{ creator_name }}',
{{ enable_photon }},
{{ enable_serverless_compute }},
'{{ instance_profile_arn }}',
{{ max_num_clusters }},
{{ min_num_clusters }},
'{{ name }}',
'{{ spot_instance_policy }}',
'{{ tags }}',
'{{ warehouse_type }}',
'{{ deployment_name }}'
RETURNING
id,
name,
creator_name,
auto_stop_mins,
channel,
cluster_size,
enable_photon,
enable_serverless_compute,
health,
instance_profile_arn,
jdbc_url,
max_num_clusters,
min_num_clusters,
num_active_sessions,
num_clusters,
odbc_params,
spot_instance_policy,
state,
tags,
warehouse_type
;
# Description fields are for documentation purposes
- name: warehouses
props:
- name: deployment_name
value: "{{ deployment_name }}"
description: Required parameter for the warehouses resource.
- name: auto_stop_mins
value: {{ auto_stop_mins }}
description: |
The amount of time in minutes that a SQL warehouse must be idle (i.e., no RUNNING queries) before it is automatically stopped. Supported values: - Must be == 0 or >= 10 mins - 0 indicates no autostop. Defaults to 120 mins
- name: channel
description: |
Channel Details
value:
dbsql_version: "{{ dbsql_version }}"
name: "{{ name }}"
- name: cluster_size
value: "{{ cluster_size }}"
description: |
Size of the clusters allocated for this warehouse. Increasing the size of a spark cluster allows you to run larger queries on it. If you want to increase the number of concurrent queries, please tune max_num_clusters. Supported values: - 2X-Small - X-Small - Small - Medium - Large - X-Large - 2X-Large - 3X-Large - 4X-Large - 5X-Large
- name: creator_name
value: "{{ creator_name }}"
description: |
warehouse creator name
- name: enable_photon
value: {{ enable_photon }}
description: |
Configures whether the warehouse should use Photon optimized clusters. Defaults to true.
- name: enable_serverless_compute
value: {{ enable_serverless_compute }}
description: |
Configures whether the warehouse should use serverless compute
- name: instance_profile_arn
value: "{{ instance_profile_arn }}"
description: |
Deprecated. Instance profile used to pass IAM role to the cluster
- name: max_num_clusters
value: {{ max_num_clusters }}
description: |
Maximum number of clusters that the autoscaler will create to handle concurrent queries. Supported values: - Must be >= min_num_clusters - Must be <= 40. Defaults to min_clusters if unset.
- name: min_num_clusters
value: {{ min_num_clusters }}
description: |
Minimum number of available clusters that will be maintained for this SQL warehouse. Increasing this will ensure that a larger number of clusters are always running and therefore may reduce the cold start time for new queries. This is similar to reserved vs. revocable cores in a resource manager. Supported values: - Must be > 0 - Must be <= min(max_num_clusters, 30) Defaults to 1
- name: name
value: "{{ name }}"
description: |
Logical name for the cluster. Supported values: - Must be unique within an org. - Must be less than 100 characters.
- name: spot_instance_policy
value: "{{ spot_instance_policy }}"
description: |
Configurations whether the endpoint should use spot instances.
- name: tags
description: |
A set of key-value pairs that will be tagged on all resources (e.g., AWS instances and EBS volumes) associated with this SQL warehouse. Supported values: - Number of tags < 45.
value:
custom_tags:
- key: "{{ key }}"
value: "{{ value }}"
- name: warehouse_type
value: "{{ warehouse_type }}"
description: |
Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless compute, you must set to `PRO` and also set the field `enable_serverless_compute` to `true`.
REPLACE examples
- edit
Updates the configuration for a SQL warehouse.
REPLACE databricks_workspace.sql.warehouses
SET
auto_stop_mins = {{ auto_stop_mins }},
channel = '{{ channel }}',
cluster_size = '{{ cluster_size }}',
creator_name = '{{ creator_name }}',
enable_photon = {{ enable_photon }},
enable_serverless_compute = {{ enable_serverless_compute }},
instance_profile_arn = '{{ instance_profile_arn }}',
max_num_clusters = {{ max_num_clusters }},
min_num_clusters = {{ min_num_clusters }},
name = '{{ name }}',
spot_instance_policy = '{{ spot_instance_policy }}',
tags = '{{ tags }}',
warehouse_type = '{{ warehouse_type }}'
WHERE
id = '{{ id }}' --required
AND deployment_name = '{{ deployment_name }}' --required
RETURNING
id,
name,
creator_name,
auto_stop_mins,
channel,
cluster_size,
enable_photon,
enable_serverless_compute,
health,
instance_profile_arn,
jdbc_url,
max_num_clusters,
min_num_clusters,
num_active_sessions,
num_clusters,
odbc_params,
spot_instance_policy,
state,
tags,
warehouse_type;
DELETE examples
- delete
Deletes a SQL warehouse.
DELETE FROM databricks_workspace.sql.warehouses
WHERE id = '{{ id }}' --required
AND deployment_name = '{{ deployment_name }}' --required
;
Lifecycle Methods
- start
- stop
Starts a SQL warehouse.
EXEC databricks_workspace.sql.warehouses.start
@id='{{ id }}' --required,
@deployment_name='{{ deployment_name }}' --required
;
Stops a SQL warehouse.
EXEC databricks_workspace.sql.warehouses.stop
@id='{{ id }}' --required,
@deployment_name='{{ deployment_name }}' --required
;