Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Note
This information applies to Databricks CLI versions 0.205 and above. The Databricks CLI is in Public Preview.
Databricks CLI use is subject to the Databricks License and Databricks Privacy Notice, including any Usage Data provisions.
The warehouses command group within the Databricks CLI allows you to manage SQL warehouses. A SQL warehouse is a compute resource that lets you run SQL commands on data objects within Databricks SQL. See Connect to a SQL warehouse.
databricks warehouses create
Create a new SQL warehouse.
databricks warehouses create [flags]
Arguments
None
Options
--auto-stop-mins int
The amount of time in minutes that a SQL warehouse must be idle (in other words, no RUNNING queries) before it is automatically stopped.
--cluster-size string
Size of the clusters allocated for this warehouse.
--creator-name string
Warehouse creator name.
--enable-photon
Configures whether the warehouse should use Photon optimized clusters.
--enable-serverless-compute
Configures whether the warehouse should use serverless compute.
--instance-profile-arn string
Deprecated.
--json JSON
The inline JSON string or the @path to the JSON file with the request body.
--max-num-clusters int
Maximum number of clusters that the autoscaler will create to handle concurrent queries.
--min-num-clusters int
Minimum number of available clusters that will be maintained for this SQL warehouse.
--name string
Logical name for the cluster.
--no-wait
Do not wait to reach RUNNING state
--spot-instance-policy SpotInstancePolicy
Configurations whether the warehouse should use spot instances. Supported values: COST_OPTIMIZED, POLICY_UNSPECIFIED, RELIABILITY_OPTIMIZED
--timeout duration
Maximum amount of time to reach RUNNING state (default 20ms)
--warehouse-type CreateWarehouseRequestWarehouseType
Warehouse type: PRO or CLASSIC. Supported values: CLASSIC, PRO, TYPE_UNSPECIFIED
Examples
The following example creates a new SQL warehouse with basic configuration:
databricks warehouses create --name "my-warehouse" --cluster-size "Small" --min-num-clusters 1 --max-num-clusters 10 --auto-stop-mins 60
The following example creates a serverless warehouse with Photon enabled:
databricks warehouses create --name "serverless-warehouse" --enable-serverless-compute --enable-photon --warehouse-type PRO
databricks warehouses create-default-warehouse-override
Create a default warehouse override for a user. Users can create their own override. Admins can create overrides for any user.
databricks warehouses create-default-warehouse-override DEFAULT_WAREHOUSE_OVERRIDE_ID TYPE [flags]
Arguments
DEFAULT_WAREHOUSE_OVERRIDE_ID
The ID for the override. Use a numeric user ID or the literal string me for the current user.
TYPE
The type of override behavior. Supported values: CUSTOM, LAST_SELECTED.
Options
--json JSON
The inline JSON string or the @path to the JSON file with the request body.
--name string
The resource name of the default warehouse override.
--warehouse-id string
The specific warehouse ID when type is CUSTOM.
Examples
The following example creates a custom warehouse override for the current user:
databricks warehouses create-default-warehouse-override me CUSTOM --warehouse-id 1234567890abcdef
databricks warehouses delete
Delete a SQL warehouse.
databricks warehouses delete ID [flags]
Arguments
ID
Required. Id of the SQL warehouse.
Options
Examples
The following example deletes a warehouse with the specified ID:
databricks warehouses delete 1234567890abcdef
databricks warehouses delete-default-warehouse-override
Delete the default warehouse override for a user. Users can delete their own override. Admins can delete overrides for any user. After deletion, the workspace default warehouse is used.
databricks warehouses delete-default-warehouse-override NAME [flags]
Arguments
NAME
The resource name of the default warehouse override to delete. Format: default-warehouse-overrides/{default_warehouse_override_id}. The ID can be a numeric user ID or the literal string me for the current user.
Options
Examples
The following example deletes the default warehouse override for the current user:
databricks warehouses delete-default-warehouse-override default-warehouse-overrides/me
databricks warehouses edit
Update a warehouse. Updates the configuration for a SQL warehouse.
databricks warehouses edit ID [flags]
Arguments
ID
Required. Id of the warehouse to configure.
Options
--auto-stop-mins int
The amount of time in minutes that a SQL warehouse must be idle (in other words, no RUNNING queries) before it is automatically stopped.
--cluster-size string
Size of the clusters allocated for this warehouse.
--creator-name string
Warehouse creator name.
--enable-photon
Configures whether the warehouse should use Photon optimized clusters.
--enable-serverless-compute
Configures whether the warehouse should use serverless compute.
--instance-profile-arn string
Deprecated.
--json JSON
The inline JSON string or the @path to the JSON file with the request body.
--max-num-clusters int
Maximum number of clusters that the autoscaler will create to handle concurrent queries.
--min-num-clusters int
Minimum number of available clusters that will be maintained for this SQL warehouse.
--name string
Logical name for the cluster.
--no-wait
Do not wait to reach RUNNING state
--spot-instance-policy SpotInstancePolicy
Configurations whether the warehouse should use spot instances. Supported values: COST_OPTIMIZED, POLICY_UNSPECIFIED, RELIABILITY_OPTIMIZED
--timeout duration
Maximum amount of time to reach RUNNING state (default 20ms)
--warehouse-type EditWarehouseRequestWarehouseType
Warehouse type. Supported values: CLASSIC, PRO, TYPE_UNSPECIFIED
Examples
The following example updates a warehouse to change its cluster size and auto-stop time:
databricks warehouses edit 1234567890abcdef --cluster-size "Medium" --auto-stop-mins 30
The following example enables Photon for an existing warehouse:
databricks warehouses edit 1234567890abcdef --enable-photon
databricks warehouses get
Get the information for a single SQL warehouse.
databricks warehouses get ID [flags]
Arguments
ID
Required. Id of the SQL warehouse.
Options
Examples
The following example gets information about a warehouse with the specified ID:
databricks warehouses get 1234567890abcdef
databricks warehouses get-default-warehouse-override
Get the default warehouse override for a user. Users can fetch their own override. Admins can fetch overrides for any user. If no override exists, the workspace default warehouse is used.
databricks warehouses get-default-warehouse-override NAME [flags]
Arguments
NAME
The resource name of the default warehouse override to retrieve. Format: default-warehouse-overrides/{default_warehouse_override_id}. The ID can be a numeric user ID or the literal string me for the current user.
Options
Examples
The following example gets the default warehouse override for the current user:
databricks warehouses get-default-warehouse-override default-warehouse-overrides/me
databricks warehouses get-workspace-warehouse-config
Get the workspace level configuration that is shared by all SQL warehouses in a workspace.
databricks warehouses get-workspace-warehouse-config [flags]
Arguments
None
Options
Examples
The following example gets the workspace warehouse configuration:
databricks warehouses get-workspace-warehouse-config
databricks warehouses list
List all SQL warehouses that a user has manage permissions on.
databricks warehouses list [flags]
Arguments
None
Options
--run-as-user-id int
Service Principal which will be used to fetch the list of warehouses.
Examples
The following example lists all warehouses:
databricks warehouses list
The following example lists warehouses using a specific service principal:
databricks warehouses list --run-as-user-id 123456789
databricks warehouses list-default-warehouse-overrides
List all default warehouse overrides in the workspace. Only workspace administrators can list all overrides.
databricks warehouses list-default-warehouse-overrides [flags]
Options
--page-size int
The maximum number of overrides to return.
--page-token string
A page token received from a previous list-default-warehouse-overrides call.
Examples
The following example lists all default warehouse overrides:
databricks warehouses list-default-warehouse-overrides
databricks warehouses set-workspace-warehouse-config
Set the workspace level configuration that is shared by all SQL warehouses in a workspace.
databricks warehouses set-workspace-warehouse-config [flags]
Arguments
None
Options
--google-service-account string
GCP only: Google Service Account used to pass to cluster to access Google Cloud Storage.
--instance-profile-arn string
AWS Only: Instance profile used to pass IAM role to the cluster.
--json JSON
The inline JSON string or the @path to the JSON file with the request body.
--security-policy SetWorkspaceWarehouseConfigRequestSecurityPolicy
Security policy for warehouses. Supported values: DATA_ACCESS_CONTROL, NONE, PASSTHROUGH
Examples
The following example sets the workspace warehouse configuration with a security policy:
databricks warehouses set-workspace-warehouse-config --security-policy DATA_ACCESS_CONTROL
databricks warehouses start
Start a SQL warehouse.
databricks warehouses start ID [flags]
Arguments
ID
Required. Id of the SQL warehouse.
Options
--no-wait
Do not wait to reach RUNNING state
--timeout duration
Maximum amount of time to reach RUNNING state (default 20ms)
Examples
The following example starts a warehouse with the specified ID:
databricks warehouses start 1234567890abcdef
The following example starts a warehouse without waiting for it to reach RUNNING state:
databricks warehouses start 1234567890abcdef --no-wait
databricks warehouses stop
Stop a SQL warehouse.
databricks warehouses stop ID [flags]
Arguments
ID
Required. Id of the SQL warehouse.
Options
--no-wait
Do not wait to reach STOPPED state
--timeout duration
Maximum amount of time to reach STOPPED state (default 20ms)
Examples
The following example stops a warehouse with the specified ID:
databricks warehouses stop 1234567890abcdef
The following example stops a warehouse without waiting for it to reach STOPPED state:
databricks warehouses stop 1234567890abcdef --no-wait
databricks warehouses update-default-warehouse-override
Update an existing default warehouse override for a user. Users can update their own override. Admins can update overrides for any user.
databricks warehouses update-default-warehouse-override NAME UPDATE_MASK TYPE [flags]
Arguments
NAME
The resource name of the default warehouse override. Format: default-warehouse-overrides/{default_warehouse_override_id}.
UPDATE_MASK
Field mask specifying which fields to update. Use * to update all fields. When --allow-missing is set, this field is ignored and all fields are applied.
TYPE
The type of override behavior. Supported values: CUSTOM, LAST_SELECTED.
Options
--allow-missing
If set and the override is not found, create a new override instead.
--json JSON
The inline JSON string or the @path to the JSON file with the request body.
--name string
The resource name of the default warehouse override.
--warehouse-id string
The specific warehouse ID when type is CUSTOM.
Examples
The following example updates the current user's override to a specific warehouse:
databricks warehouses update-default-warehouse-override default-warehouse-overrides/me warehouse_id CUSTOM --warehouse-id 1234567890abcdef
databricks warehouses get-permission-levels
Get SQL warehouse permission levels.
databricks warehouses get-permission-levels WAREHOUSE_ID [flags]
Arguments
WAREHOUSE_ID
The SQL warehouse for which to get or manage permissions.
Options
Examples
The following example gets the permission levels for a warehouse:
databricks warehouses get-permission-levels 1234567890abcdef
databricks warehouses get-permissions
Get the permissions of a SQL warehouse. SQL warehouses can inherit permissions from their root object.
databricks warehouses get-permissions WAREHOUSE_ID [flags]
Arguments
WAREHOUSE_ID
The SQL warehouse for which to get or manage permissions.
Options
Examples
The following example gets the permissions for a warehouse:
databricks warehouses get-permissions 1234567890abcdef
databricks warehouses set-permissions
Set SQL warehouse permissions. Sets permissions on an object, replacing existing permissions if they exist. Deletes all direct permissions if none are specified. Objects can inherit permissions from their root object.
databricks warehouses set-permissions WAREHOUSE_ID [flags]
Arguments
WAREHOUSE_ID
The SQL warehouse for which to get or manage permissions.
Options
--json JSON
The inline JSON string or the @path to the JSON file with the request body.
Examples
The following example sets permissions for a warehouse using a JSON file:
databricks warehouses set-permissions 1234567890abcdef --json @permissions.json
databricks warehouses update-permissions
Update the permissions on a SQL warehouse. SQL warehouses can inherit permissions from their root object.
databricks warehouses update-permissions WAREHOUSE_ID [flags]
Arguments
WAREHOUSE_ID
The SQL warehouse for which to get or manage permissions.
Options
--json JSON
The inline JSON string or the @path to the JSON file with the request body.
Examples
The following example updates permissions for a warehouse using a JSON file:
databricks warehouses update-permissions 1234567890abcdef --json @permissions.json
Global flags
--debug
Whether to enable debug logging.
-h or --help
Display help for the Databricks CLI or the related command group or the related command.
--log-file string
A string representing the file to write output logs to. If this flag is not specified then the default is to write output logs to stderr.
--log-format format
The log format type, text or json. The default value is text.
--log-level string
A string representing the log format level. If not specified then the log format level is disabled.
-o, --output type
The command output type, text or json. The default value is text.
-p, --profile string
The name of the profile in the ~/.databrickscfg file to use to run the command. If this flag is not specified then if it exists, the profile named DEFAULT is used.
--progress-format format
The format to display progress logs: default, append, inplace, or json
-t, --target string
If applicable, the bundle target to use