Skip to main content

Alation: APIを使用してメタデータを登録する

Alation

データセット、レポート、その他アセットが、AWS、Azure、GitHub、Power BIなどの環境に散在している場合、必要な情報(どのデータがどこにあるのか)を探し出すのに何日もかかることがあります。メタデータ管理は、現代のデータ戦略の要です。熟練した司書のように、適切なデータが目録化され、簡単に見つけられ、適切に維持され、組織のニーズに合っていることを保証します。そのためのメタデータ管理ソリューションの一つが Alation です: Alationの概要。

コネクタ

Alationは120以上のソースに対応したコネクタを提供しています:全コネクタ一覧

Alationはメタデータの大部分を自動的に抽出できますが、すべてではありません。 DenodoとAlationの例を見てみましょう。AlationにはDenodo用のコネクタがあります。

対応している認証方法:

  • ユーザー名とパスワードによる認証
  • SSL認証

Alationは以下のメタデータを自動的に抽出します。

  • スキーマのリスト
  • テーブルのリスト
  • ビューのリスト
  • カラムのリスト
  • データの利用頻度
  • 抽出されたテーブルの主キー情報
  • 抽出されたテーブルからのデータサンプル取得
  • 抽出されたカラムからのデータサンプル取得

ただし、以下のメタデータはコネクタで抽出できません。

  • カラムのコメント
  • カラムのデータ型
  • ソースのコメント

コネクタで抽出できないメタデータを補完するために、APIを使用することができます。

カスタムフィールドの作成

APIを使ってデータソースにメタデータフィールドを追加する方法を説明する前に、まずカスタムフィールドについて説明します。

AlationのUIでは、テーブルやスキーマなどのデータソースが「タイトル」や「説明」といったメタデータフィールドとともに表示されます。通常、これらのデフォルトのメタデータフィールドで十分ですが、新しいカスタムフィールドを追加する必要がある場合は、追加することも可能です。

Alationには、「タイトル」や「説明」といった組み込みフィールドがあります。これに加えて、カスタムフィールドを作成することも可能です。カスタムフィールドは再利用可能なオブジェクトです。
カスタムフィールドはオブジェクトテンプレートに紐づけられます。オブジェクトテンプレートは、テーブル、スキーマ、カラムといったオブジェクトの種類ごとに、メタデータの表示方法を定義します。
ほぼ全ての同じ種類のオブジェクトは共通のテンプレートを共有しています。つまり、一つのテンプレートが同じ種類のすべてのオブジェクトに適用されます。例えば、すべてのスキーマは同じスキーマテンプレートを使用します。

カスタムフィールドを(スキーマに)追加する手順:

  1. カタログ管理者またはサーバー管理者の役割が必要です。
  2. カスタムフィールドを作成します。
  3. 新しく作成したカスタムフィールドを追加して(スキーマ)テンプレートを編集します。

graph
(AI生成画像のため、テキストに一部不正確な箇所があります)

注意:AlationはすべてのカスタムフィールドにIDを割り当てます。例えば、カスタムフィールドのタイトルが “Data Sensitivity” で、その field_id が 1002 のようになります。

API

Upload Logical Metadata (ULM) API

古いAPI、Upload Logical Metadata (ULM) APIがあります。このAPIは非推奨です。使用しないでください(AlationはULM APIの使用を推奨していません)。

Upload Logical Metadata (ULM) API 非推奨化

Relational Integration API

タイトル、説明、カスタムフィールドを更新するには、Relational Integration APIを使用します。

必要な権限:データソースビューアまたはデータソース管理者

API呼び出しあたりのペイロード制限:

オブジェクトタイプ POSTペイロードの最大オブジェクト数
スキーマ 1,000
テーブル 1,000
カラム 10,000

スキーマの更新例

import requests

url = "https://alation_domain/integration/v2/schema/"

payload = [
    {
        "key": "95.employees", # スキーマ名は employees
        "title": "Schema for employees data.",
        "description": "Stores all the tables related to employees from marketing department.",
        "db_comment": "This schema is part of company database storing important PII data.",
        "custom_fields": [
             {
            "field_id": 101,
            "value": "Finance Team"       // Business Owner カスタムフィールド
            "op": "replace"
            },
            {
            "field_id": 102,
            "value": "Highly Confidential" // Data Sensitivity カスタムフィールド
            "op": "replace"
            }
        ]
    }
]
headers = {
    "accept": "application/json",
    "content-type": "application/json",
    "TOKEN": "my_secret_token"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
用語 説明
key スキーマやテーブルなどの名前
title スキーマやテーブルのタイトル(データベースには存在せず、Alationのカタログ内にのみ存在します)
db_comment データソースから取得したスキーマのコメント
op カスタムフィールドで実行する操作です。addremovereplaceのいずれかです。addremoveはMULTI_PICKERとOBJECT_SETにのみ適用可能です。replaceはすべてのカスタムフィールドに適用可能です。

custom_fieldsはオブジェクトの配列である必要があります。
AlationはすべてのカスタムフィールドにIDを割り当てます。例えば、カスタムフィールドのタイトルが “Data Sensitivity” で、その field_id が 1002 のようになります。
しかし、Relational Integration APIでは新しいカスタムフィールドを作成することはできません。更新のみ可能です。

これらのカスタムフィールドは、まずスキーマのotypeテンプレートに関連付ける必要があります。UIの「Customize Catalog」オプションから、新しいカスタムフィールドを作成し、スキーマのotypeテンプレートに追加することができます。

Custom Field Value API

Custom Field Values Async APIを使用してカスタムフィールドを更新できます。

注意:Custom Field Value APIでは、スキーマ、テーブル、カラムのタイトルや説明は更新できません。代わりにRelational Integration APIを使用してください。

制限:1リクエストあたり最大10,000オブジェクト

import requests

url = "https://alation_domain/integration/v2/custom_field_value/async/"

payload = [
    {
        "field_id": 10006, # カスタムフィールドID
        "oid": 5,  # このカスタムフィールドが属するオブジェクトのID
        "otype": "table", # このフィールドが属するオブジェクトのタイプ
        "ts_updated": "2025-09-10T07:07:33.884Z",
        "value": "my custom field value"
    },
    {
        "field_id": 10007,
        "oid": "7", # このカスタムフィールドが属するオブジェクトのID
        "otype": "attribute", # このフィールドが属するオブジェクトのタイプ
        "ts_updated": "2025-09-10T07:07:33.884Z",
        "value": ["high, medium, low"]
    }
]
headers = {
    "accept": "application/json",
    "content-type": "application/json",
    "TOKEN": "my_secret_token"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)

Comments

Popular posts from this blog

Introduction to SQLFluff: How to make your SQL code clean and error-free

Image by Jake Aldridge from Pixabay You know oftentimes, the cause of runtime or compile errors and hours of debugging agony is all due to simply a missing semicolon. Have you ever had such experience? If you had, you are not alone. There are two ways to avoid these unfortunate situations: either become a perfect developer who never makes mistakes, or use helpful tools such as linters that can catch these errors early on. I am nowhere near being a perfect developer who never makes a mistake. In fact, I'm probably the opposite of a perfect developer, so even if I wanted to, I wouldn’t be able to teach you how to become a perfect developer. But what I can teach you is using linters. A Wikipedia defines a linter as a "static code analysis tool used to flag programming errors, bugs, stylistic errors and suspicious constructs." If you're not convinced yet on using linters, consider this scenario: in a large project with multiple members, different people tend to ...

WinMerge のセットアップと使う方

WinMerge は、Windows 用のオープン ソースの差分およびマージ ツールです。WinMerge は、フォルダーとファイルの両方を比較し、違いを理解して扱いやすい視覚的なテキスト形式で表示します。この記事でWinMerge のセットアップと使う方を教えます。 source: https://winmerge.org WinMerge をダウンロード WinMerge のウェブサイト に行って、「WinMerge-2.16.44-x64-Setup.exe」ボタンを押し、WinMerge 2.16 をダウンロードしてください。 WinMerge をインストール ダウンロードされたソフトウェアをクリックし、ポップアップ画面で「Next」を押してください 「Languages」部分をスクロールダウンし、「Japanese menus and dialogs」を選択し、「Next」ボタンを押してください ターミナル等からも WinMerge をアクセス出来ようにする為に「Add WinMerge folder to your system path」オプションを選択し、希望によって他のオプション選択してください 「Enable Explorer context menu Integration」オプションを選択したら、フォルダ/ファイルを右キリックし、コンテクストメニューから WinMerge を開くようになります。 「Install」ボタンを押し、「Next」ボタンを押し、その後、「Finish」ボタンを押してください 言語を日本語にする もし WinMerge の言語が日本語じゃなくて、英語なら、「Edit」タブから「Options」を押してください。 ポップアップ画面で右側の下にある「Languages」と言うドロップダウンメニューから日本語を選択し、「OK」ボタンを押してください WinMerge を使う方 「ファイル」タッブから「開く」を押し 参照ボタンを押し、比較したいフォルダ・ファイルを指定 比較したいフォルダを指定する方法: ポップアップ画面から対象のフォルダーを選択し、「Open」を押してくだい 何も選択しないで、「Open」を押してくだい 右側下にある「比較」ボタンを押し ...

Git squash merge explained

There are many ways to integrate changes in git: regular / normal git merge, git squash merge, git rebase etc. This article explains git squash merge by comparing it to regular merge. Let’s use below example: In the repository with default main branch, after two commits, a new feature branch is created. Some work happened in feature branch. feature branch now has 2 commits that it shares with main branch, and three exclusive commits (exists only in feature branch). In the meantime, others worked on main branch and added two new commits (exists only in main branch). git log output of the main branch: c72d4a9 ( HEAD - > main ) fourth commit on main 2c3dd61 third commit on main 0c2eec3 second commit on main 9b968e8 first commit on main git log output of the feature branch: 786650f ( HEAD - > feature ) third commit on feature 21cbaf1 second commit on feature 677bc7f first commit on feature 0c2eec3 second commit on main 9b968e8 first commit on mai...