Share via


warehouses command group

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

Global flags

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 delete

Delete a SQL warehouse.

databricks warehouses delete ID [flags]

Arguments

ID

    Required. Id of the SQL warehouse.

Options

Global flags

Examples

The following example deletes a warehouse with the specified ID:

databricks warehouses delete 1234567890abcdef

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

Global flags

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

Global flags

Examples

The following example gets information about a warehouse with the specified ID:

databricks warehouses get 1234567890abcdef

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.

Global flags

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 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)

Global flags

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)

Global flags

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 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

Global flags

Examples

The following example gets the workspace warehouse configuration:

databricks warehouses get-workspace-warehouse-config

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

Global flags

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 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

Global flags

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

Global flags

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.

Global flags

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.

Global flags

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