データと AI アセットにコメントを追加する
この記事では、データアセットとAIアセットのコメントと、それらを追加する方法について説明します。 コメントは、あなたや他のユーザーが必要なデータと AI アセットを見つけて管理するのに役立ちます。
コメントは、セキュリティ保護可能なオブジェクトに注釈を付けるためのメタデータ フィールドを提供します。 Unity Catalog 内の任意のセキュリティ保護可能なオブジェクト (カタログ、スキーマ、テーブル、ボリューム、AI モデルなど) にコメントを追加できます。 また、テーブルの列にコメントを追加することもできます。
コメントは手動で追加することも、Databricks で AI が生成したコメントを作成させることもできます。 AI が生成したコメント (AI が生成したドキュメントとも呼ばれます) は、テーブルとテーブル列で使用できます。 「AI で生成されたコメントを Unity Catalog オブジェクトに追加する」を参照してください。
テーブルUnity Catalog (またはレガシーDelta Lake のHive metastore テーブル) のコメントを変更すると、テーブル履歴の 操作によって、テーブルコメントの定義に使用されたSET TBLPROPERTIES
SQLクエリが記録されます。
始める前に
コメントを追加または編集するには、次の要件を満たす必要があります。
-
カタログ、スキーマ、ボリューム、モデル、共有、受信者、プロバイダー、ストレージ認証情報、外部ロケーション、または接続に対するコメントを追加または編集するには、オブジェクトの所有者であるか、オブジェクトに対する
MANAGE
権限を持っている必要があります。 -
テーブルまたは列のコメントを追加または編集するには、所有者であるか、次の権限を持っている必要があります。
MODIFY
そしてテーブルの上にSELECT
。USE CATALOG
親カタログとスキーマにUSE SCHEMA
します。
-
SQLをサポートする ウェアハウスまたはその他のコンピュートを使用する必要があります。Unity Catalog
-
AI が生成したコメントを使用するには、ワークスペースで AI 支援機能が有効になっている必要があります。 「AI で生成されたコメントを Unity Catalog オブジェクトに追加する」を参照してください。
コメントの追加と編集
セキュリティ保護可能なオブジェクトにコメントを追加したり、SQL コマンドやカタログ エクスプローラを使用して編集したりできます。
- Catalog Explorer
- SQL
Saving comments triggers an ALTER
SQL command, which can disrupt Databricks pipelines and jobs.
-
In the workspace sidebar, click
Catalog to open Catalog Explorer.
-
Search for and select the object you want to comment on.
Data and AI objects are listed and searchable in the Catalog pane. Shares, storage credentials, external locations, and connections are accessible using the menu that opens when you click the
gear icon.
-
Add a comment or edit an existing comment.
- To add a comment to a table using AI-generated comments, view the AI Suggested Comment in the right pane of the Overview tab. It might take a few seconds to appear. Either Accept it as-is or Edit and save it.
- To add a comment to a table column using AI-generated comments, click the AI generate button above the column list. Databricks generates comments for each column. Accept them as-is or edit them. Click the check mark to save the comment.
- To add a comment to an object that doesn’t support AI-generated comments, click Add comment to add a comment.
- To add a comment to a table column without using AI-generated comments, click the
Add comment icon in the column row.
- If a comment already exists, it appears in the right pane on the Overview tab or below the object name. If it is not AI-generated, click the
edit icon to edit it.
You can use basic Markdown to style comments in the Catalog Explorer UI. Markdown styling does not render when returned by DESCRIBE
statements. All basic syntax is supported in Catalog Explorer except images, and only two heading levels are rendered. For more information, see Basic Syntax.
For more information about AI-generated comments, see Add AI-generated comments to Unity Catalog objects.
You can use a SQL command to add a string literal as a comment to any securable object in Unity Catalog and to tables managed in the legacy Hive metastore. The SQL command you use depends on the object you want to add or edit the comment for:
-
To add or update a comment for any existing securable object except table columns, use the
COMMENT ON
command. See COMMENT ON.You can also use the
COMMENT
option with theALTER <object>
command for the object (for example,ALTER TABLE
). See the SQL reference article for theALTER <object>
command. -
To add or update a column comment for an existing table, use the
ALTER TABLE
command with theALTER COLUMN
clause and theCOMMENT
option on the column. See ALTER TABLE and ALTER TABLE … COLUMN clause. -
To add a comment when you create an object, use the
COMMENT
option with theCREATE <object>
command. See the SQL reference article for theCREATE <object>
command that you want to use.