Share via


table-constraints 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 table-constraints command group within the Databricks CLI contains commands to manage primary key and foreign key constraints that encode relationships between fields in tables.

databricks table-constraints create

Create a new table constraint.

For the table constraint creation to succeed, the user must satisfy both of these conditions:

  • the user must have the USE_CATALOG privilege on the table's parent catalog, the USE_SCHEMA privilege on the table's parent schema, and be the owner of the table.
  • if the new constraint is a ForeignKeyConstraint, the user must have the USE_CATALOG privilege on the referenced parent table's catalog, the USE_SCHEMA privilege on the referenced parent table's schema, and be the owner of the referenced parent table.
databricks table-constraints create [flags]

Options

--json JSON

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

Global flags

databricks table-constraints delete

Delete a table constraint.

For the table constraint deletion to succeed, the user must satisfy both of these conditions:

  • the user must have the USE_CATALOG privilege on the table's parent catalog, the USE_SCHEMA privilege on the table's parent schema, and be the owner of the table.
  • if cascade argument is true, the user must have the following permissions on all of the child tables: the USE_CATALOG privilege on the table's catalog, the USE_SCHEMA privilege on the table's schema, and be the owner of the table.
databricks table-constraints delete FULL_NAME CONSTRAINT_NAME CASCADE [flags]

Arguments

FULL_NAME

    Full name of the table referenced by the constraint.

CONSTRAINT_NAME

    The name of the constraint to delete.

CASCADE

    If true, try deleting all child constraints of the current constraint. If false, reject this operation if the current constraint has any child constraints.

Options

Global flags

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