Share via


tables 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 tables command group within the Databricks CLI contains commands to manage tables in Unity Catalog. A table resides in the third layer of Unity Catalog's three-level namespace. It contains rows of data.

databricks tables delete

Delete a table from the specified parent catalog and schema. The caller must be the owner of the parent catalog, have the USE_CATALOG privilege on the parent catalog and be the owner of the parent schema, or be the owner of the table and have the USE_CATALOG privilege on the parent catalog and the USE_SCHEMA privilege on the parent schema.

databricks tables delete FULL_NAME [flags]

Arguments

FULL_NAME

    Full name of the table.

Options

Global flags

Examples

The following example deletes a table:

databricks tables delete my_catalog.my_schema.my_table

databricks tables exists

Get whether a table exists in the metastore for a specific catalog and schema. The caller must satisfy one of the following requirements:

  • Be a metastore admin
  • Be the owner of the parent catalog
  • Be the owner of the parent schema and have the USE_CATALOG privilege on the parent catalog
  • Have the USE_CATALOG privilege on the parent catalog and the USE_SCHEMA privilege on the parent schema, and either be the table owner or have the SELECT privilege on the table.
  • Have BROWSE privilege on the parent catalog
  • Have BROWSE privilege on the parent schema.
databricks tables exists FULL_NAME [flags]

Arguments

FULL_NAME

    Full name of the table.

Options

Global flags

Examples

The following example checks if a table exists:

databricks tables exists my_catalog.my_schema.my_table

databricks tables get

Get a table from the metastore for a specific catalog and schema. The caller must satisfy one of the following requirements:

  • Be a metastore admin
  • Be the owner of the parent catalog
  • Be the owner of the parent schema and have the USE_CATALOG privilege on the parent catalog
  • Have the USE_CATALOG privilege on the parent catalog and the USE_SCHEMA privilege on the parent schema, and either be the table owner or have the SELECT privilege on the table.
databricks tables get FULL_NAME [flags]

Arguments

FULL_NAME

    Full name of the table.

Options

--include-browse

    Whether to include tables in the response for which the principal can only access selective metadata for.

--include-delta-metadata

    Whether delta metadata should be included in the response.

--include-manifest-capabilities

    Whether to include a manifest containing capabilities the table has.

Global flags

Examples

The following example gets information about a table:

databricks tables get my_catalog.my_schema.my_table

The following example gets a table with delta metadata included:

databricks tables get my_catalog.my_schema.my_table --include-delta-metadata

databricks tables list

List all tables for the current metastore under the parent catalog and schema. The caller must be a metastore admin or an owner of (or have the SELECT privilege on) the table. For the latter case, the caller must also be the owner or have the USE_CATALOG privilege on the parent catalog and the USE_SCHEMA privilege on the parent schema. There is no guarantee of a specific ordering of the elements in the array.

databricks tables list CATALOG_NAME SCHEMA_NAME [flags]

Arguments

CATALOG_NAME

    Name of parent catalog for tables of interest.

SCHEMA_NAME

    Parent schema of tables.

Options

--include-browse

    Whether to include tables in the response for which the principal can only access selective metadata for.

--include-delta-metadata

    Whether delta metadata should be included in the response.

--include-manifest-capabilities

    Whether to include a manifest containing capabilities the table has.

--max-results int

    Maximum number of tables to return.

--omit-columns

    Whether to omit the columns of the table from the response or not.

--omit-properties

    Whether to omit the properties of the table from the response or not.

--omit-username

    Whether to omit the username of the table (e.g.

--page-token string

    Opaque token to send for the next page of results (pagination).

Global flags

Examples

The following example lists all tables in a catalog and schema:

databricks tables list my_catalog my_schema

The following example lists tables with columns omitted:

databricks tables list my_catalog my_schema --omit-columns

databricks tables list-summaries

List summaries for tables for a schema and catalog within the metastore. The table summaries returned are either:

  • summaries for tables (within the current metastore and parent catalog and schema), when the user is a metastore admin,
  • or summaries for tables and schemas (within the current metastore and parent catalog) for which the user has ownership or the SELECT privilege on the table and ownership or USE_SCHEMA privilege on the schema, provided that the user also has ownership or the USE_CATALOG privilege on the parent catalog.

There is no guarantee of a specific ordering of the elements in the array.

databricks tables list-summaries CATALOG_NAME [flags]

Arguments

CATALOG_NAME

    Name of parent catalog for tables of interest.

Options

--include-manifest-capabilities

    Whether to include a manifest containing capabilities the table has.

--max-results int

    Maximum number of summaries for tables to return.

--page-token string

    Opaque pagination token to go to next page based on previous query.

--schema-name-pattern string

    A sql LIKE pattern (% and _) for schema names.

--table-name-pattern string

    A sql LIKE pattern (% and _) for table names.

Global flags

Examples

The following example lists table summaries for a catalog:

databricks tables list-summaries my_catalog

The following example lists table summaries with schema name pattern:

databricks tables list-summaries my_catalog --schema-name-pattern "prod_%"

The following example lists table summaries with table name pattern:

databricks tables list-summaries my_catalog --table-name-pattern "fact_%"

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