Share via


database 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 database command group within the Databricks CLI contains commands to manage database instances. Database instances manage storage and compute resources and provide the endpoints that users connect to.

See What is a database instance?.

databricks database create-database-catalog

Create a database catalog.

databricks database create-database-catalog NAME DATABASE_INSTANCE_NAME DATABASE_NAME [flags]

Arguments

NAME

    The name of the catalog in Unity Catalog.

DATABASE_INSTANCE_NAME

    The name of the DatabaseInstance housing the database.

DATABASE_NAME

    The name of the database (in a instance) associated with the catalog.

Options

--create-database-if-not-exists

    Create the database if it does not exist.

--json JSON

    The inline JSON string or the @path to the JSON file with the request body.

Global flags

Examples

The following example creates a database catalog:

databricks database create-database-catalog my-catalog my-instance my-database

databricks database create-database-instance

Create a database instance.

databricks database create-database-instance NAME [flags]

Arguments

NAME

    The name of the instance. This is the unique identifier for the instance.

Options

--capacity string

    The sku of the instance.

--json JSON

    The inline JSON string or the @path to the JSON file with the request body.

--stopped

    Whether the instance is stopped.

Global flags

Examples

The following example creates a database instance:

databricks database create-database-instance my-instance --capacity small

databricks database create-database-table

Create a database table.

databricks database create-database-table NAME [flags]

Arguments

NAME

    Full three-part (catalog, schema, table) name of the table.

Options

--database-instance-name string

    Name of the target database instance.

--json JSON

    The inline JSON string or the @path to the JSON file with the request body.

--logical-database-name string

    Target Postgres database object (logical database) name for this table.

Global flags

Examples

The following example creates a database table:

databricks database create-database-table catalog.schema.table --database-instance-name my-instance

databricks database create-synced-database-table

Create a synced database table.

databricks database create-synced-database-table NAME [flags]

Arguments

NAME

    Full three-part (catalog, schema, table) name of the table.

Options

--database-instance-name string

    Name of the target database instance.

--json JSON

    The inline JSON string or the @path to the JSON file with the request body.

--logical-database-name string

    Target Postgres database object (logical database) name for this table.

Global flags

Examples

The following example creates a synced database table:

databricks database create-synced-database-table catalog.schema.table --database-instance-name my-instance

databricks database delete-database-catalog

Delete a Database Catalog.

databricks database delete-database-catalog NAME [flags]

Arguments

NAME

    The name of the catalog to delete.

Options

Global flags

Examples

The following example deletes a database catalog:

databricks database delete-database-catalog my-catalog

databricks database delete-database-instance

Delete a database instance.

databricks database delete-database-instance NAME [flags]

Arguments

NAME

    Name of the instance to delete.

Options

--force

    By default, a instance cannot be deleted if it has descendant instances created via PITR.

--purge

    Note purge=false is in development.

Global flags

Examples

The following example deletes a database instance:

databricks database delete-database-instance my-instance --force

databricks database delete-database-table

Delete a database table.

databricks database delete-database-table NAME [flags]

Arguments

NAME

    Full three-part (catalog, schema, table) name of the table to delete.

Options

Global flags

Examples

The following example deletes a database table:

databricks database delete-database-table catalog.schema.table

databricks database delete-synced-database-table

Delete a synced database table.

databricks database delete-synced-database-table NAME [flags]

Arguments

NAME

    Full three-part (catalog, schema, table) name of the synced table to delete.

Options

Global flags

Examples

The following example deletes a synced database table:

databricks database delete-synced-database-table catalog.schema.table

databricks database find-database-instance-by-uid

Find a database instance by uid.

databricks database find-database-instance-by-uid [flags]

Options

--uid string

    UID of the cluster to get.

Global flags

Examples

The following example finds a database instance by UID:

databricks database find-database-instance-by-uid --uid 12345-abcdef-67890

databricks database generate-database-credential

Generates a credential that can be used to access database instances.

databricks database generate-database-credential [flags]

Options

--json JSON

    The inline JSON string or the @path to the JSON file with the request body.

--request-id string

    Request ID for the credential generation.

Global flags

Examples

The following example generates a database credential:

databricks database generate-database-credential --request-id my-request-123

databricks database get-database-catalog

Get a Database Catalog.

databricks database get-database-catalog NAME [flags]

Arguments

NAME

    The name of the catalog to get.

Options

Global flags

Examples

The following example gets information about a database catalog:

databricks database get-database-catalog my-catalog

databricks database get-database-instance

Get a database instance.

databricks database get-database-instance NAME [flags]

Arguments

NAME

    Name of the cluster to get.

Options

Global flags

Examples

The following example gets information about a database instance:

databricks database get-database-instance my-instance

databricks database get-database-table

Get a database table.

databricks database get-database-table NAME [flags]

Arguments

NAME

    Full three-part (catalog, schema, table) name of the table to get.

Options

Global flags

Examples

The following example gets information about a database table:

databricks database get-database-table catalog.schema.table

databricks database get-synced-database-table

Get a synced database table.

databricks database get-synced-database-table NAME [flags]

Arguments

NAME

    Full three-part (catalog, schema, table) name of the synced table to get.

Options

Global flags

Examples

The following example gets information about a synced database table:

databricks database get-synced-database-table catalog.schema.table

databricks database list-database-instances

List database instances.

databricks database list-database-instances [flags]

Options

--page-size int

    Upper bound for items returned.

--page-token string

    Pagination token to go to the next page of database instances.

Global flags

Examples

The following example lists all database instances:

databricks database list-database-instances

The following example lists database instances with pagination:

databricks database list-database-instances --page-size 10

databricks database update-database-instance

Update a database instance.

databricks database update-database-instance NAME [flags]

Arguments

NAME

    The name of the instance. This is the unique identifier for the instance.

Options

--capacity string

    The sku of the instance.

--json JSON

    The inline JSON string or the @path to the JSON file with the request body.

--stopped

    Whether the instance is stopped.

Global flags

Examples

The following example updates a database instance capacity:

databricks database update-database-instance my-instance --capacity large

The following example stops a database instance:

databricks database update-database-instance my-instance --stopped

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