Skip to main content

database command group

note

Databricks CLI use is subject to the Databricks License and Databricks Privacy Notice, including any Usage Data provisions.

note

These commands are not supported on Google Cloud.

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.

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. For JSON reference, see Database Catalog.

Global flags

Examples​

The following example creates a database catalog:

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

databricks database create-database-instance​

Create a database instance.

note

To set nested fields that are not available as arguments, use the --json option to specify the full request body.

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 capacity SKU of the instance. Valid values are: CU_1, CU_2, CU_4, CU_8.

--json JSON

    The inline JSON string or the @path to the JSON file with the request body. For JSON reference, see Database Instance.

--stopped

    Whether the instance is stopped.

Global flags

Examples​

The following example creates a database instance:

Bash
databricks database create-database-instance my-instance --capacity CU_1

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. For JSON reference, see Database Table.

--logical-database-name string

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

Global flags

Examples​

The following example creates a database table:

Bash
databricks database create-database-table my-catalog.my-schema.my-table --database-instance-name my-instance --logical-database-name dbname

databricks database create-synced-database-table​

Create a synced database table.

note

To set nested fields that are not available as arguments, use the --json option to specify the full request body.

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. For JSON reference, see Synced Database Table.

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

Bash
databricks database create-synced-database-table --json '{"name": "main.my-schema.my-table", "database_instance_name": "my-instance", "logical_database_name": "testdb", "spec": {"primary_key_columns": ["col1"], "existing_pipeline_id": "999999z9-dz9b-4zf7-c178-15b777772e6z", "scheduling_policy": "SNAPSHOT", "source_table_full_name": "main.my-instance.t"}}'

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:

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

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

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

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

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

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

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

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

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

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

Bash
databricks database list-database-instances

The following example lists database instances with pagination:

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

databricks database update-database-instance​

Update a database instance.

databricks database update-database-instance NAME UPDATE_MASK [flags]

Arguments​

NAME

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

UPDATE_MASK

    A mask specifying which fields to update. Use * to update all specified fields.

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:

Bash
databricks database update-database-instance my-instance '*' --capacity CU_4

The following example stops a database instance:

Bash
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