Skip to main content

warehouses

Creates, updates, deletes, gets or lists a warehouses resource.

Overview

Namewarehouses
TypeResource
Iddatabricks_workspace.sql.warehouses

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringunique identifier for warehouse
namestringLogical name for the cluster. Supported values: - Must be unique within an org. - Must be less than 100 characters.
creator_namestringwarehouse creator name
auto_stop_minsinteger
channelobjectChannel Details
cluster_sizestringSize 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
enable_photonbooleanConfigures whether the warehouse should use Photon optimized clusters. Defaults to false.
enable_serverless_computebooleanConfigures whether the warehouse should use serverless compute
healthobjectOptional health status. Assume the warehouse is healthy if this field is not set.
instance_profile_arnstringDeprecated. Instance profile used to pass IAM role to the cluster
jdbc_urlstringthe jdbc connection string for this warehouse
max_num_clustersintegerMaximum 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_clustersintegerMinimum 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_sessionsintegerDeprecated. current number of active sessions for the warehouse
num_clustersintegercurrent number of clusters running for the service
odbc_paramsobjectODBC parameters for the SQL warehouse
spot_instance_policystringConfigurations whether the endpoint should use spot instances. (COST_OPTIMIZED, POLICY_UNSPECIFIED, RELIABILITY_OPTIMIZED)
statestringstate of the endpoint (DELETED, DELETING, RUNNING, STARTING, STOPPED, STOPPING)
tagsobjectA 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_typestringWarehouse 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:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectid, deployment_nameGets the information for a single SQL warehouse.
listselectdeployment_namepage_size, page_token, run_as_user_idLists all SQL warehouses that a user has access to.
createinsertdeployment_nameCreates a new SQL warehouse.
editreplaceid, deployment_nameUpdates the configuration for a SQL warehouse.
deletedeleteid, deployment_nameDeletes a SQL warehouse.
startexecid, deployment_nameStarts a SQL warehouse.
stopexecid, deployment_nameStops 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.

NameDatatypeDescription
deployment_namestringThe Databricks Workspace Deployment Name (default: dbc-abcd0123-a1bc)
idstringRequired. Id of the SQL warehouse.
page_sizeintegerThe max number of warehouses to return.
page_tokenstringA 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_idintegerService 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

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
;

INSERT examples

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
;

REPLACE examples

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

Deletes a SQL warehouse.

DELETE FROM databricks_workspace.sql.warehouses
WHERE id = '{{ id }}' --required
AND deployment_name = '{{ deployment_name }}' --required
;

Lifecycle Methods

Starts a SQL warehouse.

EXEC databricks_workspace.sql.warehouses.start 
@id='{{ id }}' --required,
@deployment_name='{{ deployment_name }}' --required
;