Skip to main content

account metastore-assignments 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 account metastore-assignments command group within the Databricks CLI contains commands to manage metastore assignments to workspaces. These commands allow you to create, get, list, update, and delete metastore assignments, controlling which Unity Catalog metastore is associated with each workspace.

databricks account metastore-assignments create

Assign a workspace to a metastore. Creates an assignment to a metastore for a workspace.

databricks account metastore-assignments create WORKSPACE_ID METASTORE_ID [flags]

Arguments

WORKSPACE_ID

    Workspace ID.

METASTORE_ID

    Unity Catalog metastore ID.

Options

--json JSON

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

Global flags

Examples

The following example assigns a workspace to a metastore:

Bash
databricks account metastore-assignments create 123456789 metastore-abc123

The following example assigns a workspace to a metastore using JSON:

Bash
databricks account metastore-assignments create 123456789 metastore-abc123 --json '{"defaultCatalogName": "main"}'

The following example assigns a workspace to a metastore using a JSON file:

Bash
databricks account metastore-assignments create 123456789 metastore-abc123 --json @metastore-assignment.json

databricks account metastore-assignments delete

Delete a metastore assignment to a workspace, leaving the workspace with no metastore.

databricks account metastore-assignments delete WORKSPACE_ID METASTORE_ID [flags]

Arguments

WORKSPACE_ID

    Workspace ID.

METASTORE_ID

    Unity Catalog metastore ID.

Options

Global flags

Examples

The following example deletes a metastore assignment:

Bash
databricks account metastore-assignments delete 123456789 metastore-abc123

databricks account metastore-assignments get

Get the metastore assignment for a workspace. If the workspace is assigned a metastore, the mapping will be returned. If no metastore is assigned to the workspace, the assignment will not be found and a 404 is returned.

databricks account metastore-assignments get WORKSPACE_ID [flags]

Arguments

WORKSPACE_ID

    Workspace ID.

Options

Global flags

Examples

The following example gets the metastore assignment for a workspace:

Bash
databricks account metastore-assignments get 123456789

databricks account metastore-assignments list

Get a list of all Databricks workspace IDs that have been assigned to a given metastore.

databricks account metastore-assignments list METASTORE_ID [flags]

Arguments

METASTORE_ID

    Unity Catalog metastore ID.

Options

Global flags

Examples

The following example lists all workspaces assigned to a metastore:

Bash
databricks account metastore-assignments list metastore-abc123

databricks account metastore-assignments update

Update an assignment to a metastore for a workspace. Currently, only the default catalog may be updated.

databricks account metastore-assignments update WORKSPACE_ID METASTORE_ID [flags]

Arguments

WORKSPACE_ID

    Workspace ID.

METASTORE_ID

    Unity Catalog metastore ID.

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 a metastore assignment using JSON:

Bash
databricks account metastore-assignments update 123456789 metastore-abc123 --json '{"defaultCatalogName": "updated_catalog"}'

The following example updates a metastore assignment using a JSON file:

Bash
databricks account metastore-assignments update 123456789 metastore-abc123 --json @update-metastore-assignment.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