カタログの管理
この記事では、Unity Catalog でカタログを表示、更新、削除する方法について説明します。 カタログには スキーマ (データベース) が含まれ、スキーマにはテーブル、ビュー、ボリューム、モデル、および関数が含まれます。
カタログの詳細については、「Databricksのカタログとは」および「カタログの作成」を参照してください。カタログへのアクセスを許可および取り消す方法については、「 Unity Catalog の特権とセキュリティ保護可能なオブジェクト」を参照してください。
フォーリンカタログ (外部データ・システム内のデータベースをミラーリングするUnity Catalogオブジェクト) の管理方法については、フォーリンカタログの管理と操作を参照してください。
必要条件
カタログを表示、更新、または削除するには:
-
タスクを実行する ワークスペースにリンクされた Unity Catalog メタストアが必要です。
-
ノートブックを実行してカタログを管理するために使用するクラスターでは、Unity Catalog 準拠のアクセスモードを使用する必要があります。 「アクセスモード」を参照してください。
SQLウェアハウスは常に Unity Catalogをサポートしています。
必要な権限はタスクによって異なり、次の各セクションで説明します。
カタログの詳細を表示する
権限が必要 : ユーザーは、自分が所有しているカタログ、または USE CATALOG
権限または BROWSE
権限が割り当てられているすべてのカタログのメタデータを表示できます。
カタログに関する情報を表示するには、Catalog Explorer または SQL コマンドを使用できます。
- Catalog Explorer
- SQL
-
Log in to a workspace that is linked to the metastore.
-
Click
Catalog.
-
In the Catalog pane, find the catalog and click its name.
Some details are listed at the top of the page. Others can be viewed on the Schemas, Details, Permissions, and Workspaces tabs.
Run SHOW CATALOGS
in a notebook or the SQL query editor to list all catalogs in a metastore or those that match a regular expression.
Run the following SQL command to get details about a catalog. Items in brackets are optional. Replace the placeholder <catalog-name>
.
DESCRIBE CATALOG <catalog-name>;
Use CATALOG EXTENDED
to get full details.
For more information, see DESCRIBE CATALOG.
カタログを更新する
カタログを更新 (または変更) するには、Catalog Explorer または SQL コマンドを使用できます。
必要な権限 : カタログの更新に必要な権限は、更新によって異なります。
- 所有者を変更するには、所有者であるか、カタログに
MANAGE
とUSE CATALOG
が必要です。 - カタログの名前を変更するには、所有者であるか、カタログに
MANAGE
とUSE CATALOG
を持っている必要があります。 - コメントやタグを追加または更新するには、自分が所有者であるか、カタログに
MANAGE
またはMODIFY
とUSE CATALOG
を持っている必要があります。 - カタログに対するアクセス許可を付与および取り消すには、カタログの所有者、メタストア管理者、またはカタログに対する
MANAGE
とUSE CATALOG
を持っている必要があります。
- Catalog Explorer
- SQL
- Log into a workspace that is linked to the Unity Catalog metastore.
- Click
Catalog.
- In the Catalog pane on the left, click the catalog that you want to update.
- Use the following page elements on the catalog details page to update the catalog:
- Overview tab: update the owner, add or update tags, add or update comments. See Manage Unity Catalog object ownership, Apply tags to Unity Catalog securable objects, and Add comments to data and AI assets.
- Permissions tab: grant and revoke privileges on the catalog. See Manage privileges in Unity Catalog.
- The
kebab menu: Rename the catalog.
- Create schema button: add a schema to the catalog. See Create schemas.
- To change the owner, add or update tags, and manage predictive optimization on the tables in a catalog, run the
ALTER CATALOG
command in a notebook or the SQL query editor. See ALTER CATALOG. - To grant or revoke privileges, use the
GRANT
orREVOKE
command. See GRANT and REVOKE. - To add schemas to the catalog, see What are schemas in Databricks?.
- To rename a catalog using SQL, you must create a new catalog and move all assets into the new catalog.
カタログの削除
カタログを削除 (またはドロップ) するには、カタログ エクスプローラーまたは SQL コマンドを使用できます。
権限が必要 : カタログの所有者またはカタログの MANAGE
と USE CATALOG
。
- Catalog Explorer
- SQL
You must delete all schemas in the catalog except information_schema
before you can delete a catalog. This includes the auto-created default
schema.
- Log in to a workspace that is linked to the metastore.
- Click
Catalog.
- In the Catalog pane, on the left, click the catalog you want to delete.
- In the detail pane, click the kebab menu
to the left of the Create database button and select Delete.
- On the Delete catalog dialog, click Delete.
Run the following SQL command in a notebook or Databricks SQL editor. Items in brackets are optional. Replace the placeholder <catalog-name>
.
For parameter descriptions, see DROP CATALOG.
If you use DROP CATALOG
without the CASCADE
option, you must delete all schemas in the catalog except information_schema
before you can delete the catalog. This includes the auto-created default
schema.
DROP CATALOG [ IF EXISTS ] <catalog-name> [ RESTRICT | CASCADE ]
For example, to delete a catalog named vaccine
and its schemas:
DROP CATALOG vaccine CASCADE