共用方式為


Unity 目錄 CLI (舊版)

重要

此檔已淘汰,且可能未更新。

此資訊適用於舊版 Databricks CLI 0.18 版和更新版本。 Databricks 建議您改用較新的 Databricks CLI 0.205 版或更新版本。 請參閱 什麼是 Databricks CLI?。 若要尋找 Databricks CLI 版本請執行 databricks -v

若要從 Databricks CLI 0.18 版或更新版本移轉至 Databricks CLI 0.205 版或更新版本,請參閱 Databricks CLI 移轉

注意

Unity 目錄 CLI 是 實驗性的

Unity 目錄 CLI 需要 Databricks CLI(舊版)0.17.0 或更新版本,且已設定驗證。 若要更新 Databricks CLI 或列出已安裝的版本,請參閱 更新 CLI

下列範例中的選項和欄位範例值僅供說明之用。

使用 Unity 目錄 CLI 來處理:

您可以將 Unity 目錄 CLI 子命令附加至 , databricks unity-catalog以執行這些命令。 這些子命令會呼叫 Unity 類別目錄 API,其中也包含差異共用 API。

若要顯示使用方式檔,請執行 databricks unity-catalog --help

輸出:

Usage: databricks unity-catalog [OPTIONS] COMMAND [ARGS]...

  Utility to interact with Databricks Unity Catalog.

Options:
  -v, --version  0.17.1
  -h, --help     Show this message and exit.

Commands:
  catalogs
  external-locations
  lineage
  metastores
  permissions
  providers
  recipients
  schemas
  shares
  storage-credentials
  tables

中繼存放區

unity-catalog metastores使用子命令來處理中繼存放區

若要顯示使用方式檔,請執行 databricks unity-catalog metastores --help

建立中繼存放區

若要顯示使用方式檔,請執行 databricks unity-catalog metastores create --help。 另 請參閱建立 Unity 目錄中繼存放區

注意

建立中繼存放區不會自動將中繼存放區與工作區或記憶體認證產生關聯。 若要完成這些工作,請參閱 連結中繼存放區與工作區建立記憶體認證更新中繼存放區的設定

如果您在已指派中繼存放區的工作區上執行此命令,您將更新該工作區指派的中繼存放區。

若要顯示使用方式檔,請執行 databricks unity-catalog metastores assign --help

databricks unity-catalog metastores assign --workspace-id 1234567890123456 \
                                           --metastore-id 12a345b6-7890-1cd2-3456-e789f0a12b34 \
                                           --default-catalog-name main

若要取得工作區標識碼,請參閱 工作區實例名稱、URL 和標識符

若要取得中繼存放區識別碼,請執行 databricks unity-catalog metastores get-summary。 如需範例,請參閱 取得目前中繼存放區的相關摘要資訊。

輸出:

{}

請參閱建立 Unity 目錄中繼存放區

更新中繼存放區的設定

若要顯示使用方式檔,請執行 databricks unity-catalog metastores update --help

databricks unity-catalog metastores update --id 12a345b6-7890-1cd2-3456-e789f0a12b34 \
                                           --json-file update-metastore.json

若要取得中繼存放區識別碼,請執行 databricks unity-catalog metastores get-summary。 如需範例,請參閱 取得目前中繼存放區的相關摘要資訊。

update-metastore.json

{
  "storage_root_credential_id": "12a345b6-7890-1cd2-3456-e789f0a12b34"
}

若要取得記憶體根認證標識符,請參閱 取得記憶體認證的相關信息。

列出可用的中繼存放區

若要顯示使用方式檔,請執行 databricks unity-catalog metastores list --help

databricks unity-catalog metastores list

取得中繼存放區的相關信息

若要顯示使用方式檔,請執行 databricks unity-catalog metastores get --help

databricks unity-catalog metastores get --id 12a345b6-7890-1cd2-3456-e789f0a12b34

若要取得中繼存放區識別碼,請執行 databricks unity-catalog metastores get-summary。 如需範例,請參閱 取得目前中繼存放區的相關摘要資訊。

取得目前中繼存放區的相關摘要資訊

若要顯示使用方式檔,請執行 databricks unity-catalog metastores get-summary --help

databricks unity-catalog metastores get-summary

取得工作區目前的中繼存放區指派

若要顯示使用方式檔,請執行 databricks unity-catalog metastores get-assignment --help

databricks unity-catalog metastores get-assignment

輸出:

{
  "workspace_id": 1234567890123456,
  "metastore_id": "12a345b6-7890-1cd2-3456-e789f0a12b34",
  "default_catalog_name": "main"
}

若要顯示使用方式檔,請執行 databricks unity-catalog metastores unassign --help

databricks unity-catalog metastores unassign --workspace-id 1234567890123456 \
                                             --metastore-id 12a345b6-7890-1cd2-3456-e789f0a12b34

若要取得工作區標識碼,請參閱 工作區實例名稱、URL 和標識符

若要取得中繼存放區識別碼,請執行 databricks unity-catalog metastores get-summary。 如需範例,請參閱 取得目前中繼存放區的相關摘要資訊。

輸出:

{}

刪除中繼存放區

警告

刪除中繼存放區之前,您必須先刪除使用中繼存放區的任何工作區,或移除這些工作區的中繼存放區連結。 請連絡 Azure Databricks 支援人員以取得從工作區移除中繼存放區連結的協助。

若要顯示使用方式檔,請執行 databricks unity-catalog metastores delete --help

若要強制刪除中繼存放區,請使用 --force 選項。

databricks unity-catalog metastores delete --id 12a345b6-7890-1cd2-3456-e789f0a12b34

若要取得中繼存放區識別碼,請執行 databricks unity-catalog metastores get-summary。 如需範例,請參閱 取得目前中繼存放區的相關摘要資訊。

如果作業成功,則不會傳回任何結果。

記憶體認證

unity-catalog storage-credentials使用子命令來處理記憶體認證。 請參閱 建立記憶體認證以連線到 Azure Data Lake Storage Gen2

若要顯示使用方式檔,請執行 databricks unity-catalog storage-credentials --help

建立記憶體認證

若要顯示使用方式檔,請執行 databricks unity-catalog storage-credentials create --help

請參閱建立記憶體認證以連線到 Azure Data Lake Storage Gen2

更新記憶體認證的設定

若要顯示使用方式檔,請執行 databricks unity-catalog storage-credentials update --help

列出可用的記憶體認證

若要顯示使用方式檔,請執行 databricks unity-catalog storage-credentials list --help

databricks unity-catalog storage-credentials list

取得記憶體認證的相關信息

若要顯示使用方式檔,請執行 databricks unity-catalog storage-credentials get --help

databricks unity-catalog storage-credentials get --name my-storage-root-credential

刪除記憶體認證

若要顯示使用方式檔,請執行 databricks unity-catalog storage-credentials delete --help

若要強制刪除記憶體認證,請使用 --force 選項。

databricks unity-catalog storage-credentials delete --name my-storage-root-credential

如果作業成功,則不會傳回任何結果。

外部位置

unity-catalog external-locations使用子命令來處理外部位置。 請參閱 建立外部位置以將雲端記憶體連線到 Azure Databricks

若要顯示使用方式檔,請執行 databricks unity-catalog external-locations --help

建立外部位置

若要顯示使用方式檔,請執行 databricks unity-catalog external-locations create --help。 另 請參閱建立外部位置以將雲端記憶體連線到 Azure Databricks

驗證外部位置和認證組

若要顯示使用方式檔,請執行 databricks unity-catalog external-locations validate --help

在您建立外部位置名稱和認證組之後,驗證它們

databricks unity-catalog external-locations validate --name my-external-location \
                                                     --cred-name my-storage-root-credential

輸出:

{
  "isDir": true,
  "results": [
    {
      "operation": "READ",
      "result": "PASS"
    },
    {
      "operation": "LIST",
      "result": "PASS"
    },
    {
      "operation": "WRITE",
      "result": "PASS"
    },
    {
      "operation": "DELETE",
      "result": "PASS"
    }
  ]
}

更新外部位置的設定

若要顯示使用方式檔,請執行 databricks unity-catalog external-locations update --help

databricks unity-catalog external-locations update --name my-external-location \
                                                   --json-file update-external-location.json

udpate-external-location.json

{
  "name": "my-external-location-2"
}

列出可用的外部位置

若要顯示使用方式檔,請執行 databricks unity-catalog external-locations list --help

databricks unity-catalog external-locations list

取得外部位置的相關信息

若要顯示使用方式檔,請執行 databricks unity-catalog external-locations get --help

databricks unity-catalog external-locations get --name my-external-location

刪除外部位置

若要顯示使用方式檔,請執行 databricks unity-catalog external-locations delete --help

若要強制刪除外部位置,請使用 --force 選項。

databricks unity-catalog external-locations delete --name my-external-location

如果作業成功,則不會傳回任何結果。

目錄

unity-catalog catalogs使用子命令來處理目錄

若要顯示使用方式檔,請執行 databricks unity-catalog catalogs --help

建立目錄

若要顯示使用方式檔,請執行 databricks unity-catalog catalogs create --help。 另 請參閱建立目錄

databricks unity-catalog catalogs create --name my-catalog

輸出:

{
  "name": "my-catalog",
  "owner": "someone@example.com",
  "metastore_id": "12a345b6-7890-1cd2-3456-e789f0a12b34",
  "created_at": 1656113178995,
  "created_by": "someone@example.com",
  "updated_at": 1656113178995,
  "updated_by": "someone@example.com",
  "catalog_type": "MANAGED_CATALOG"
}

更新目錄的設定

若要顯示使用方式檔,請執行 databricks unity-catalog catalogs update --help

databricks unity-catalog catalogs update --name my-catalog \
                                         --json-file update-catalog.json

update-catalog.json

{
  "name": "my-catalog-2",
  "owner": "someone@example.com"
}

輸出:

{
  "name": "my-catalog-2",
  "owner": "someone@example.com",
  "metastore_id": "12a345b6-7890-1cd2-3456-e789f0a12b34",
  "created_at": 1656355967835,
  "created_by": "someone@example.com",
  "updated_at": 1656356095989,
  "updated_by": "someone@example.com",
  "catalog_type": "MANAGED_CATALOG"
}

列出可用的目錄

若要顯示使用方式檔,請執行 databricks unity-catalog catalogs list --help

databricks unity-catalog catalogs list

輸出:

{
  "catalogs": [
    {
      "name": "main",
      "owner": "someone@example.com",
      "comment": "Main catalog (auto-created)",
      "metastore_id": "12a345b6-7890-1cd2-3456-e789f0a12b34",
      "created_at": 1656112029355,
      "created_by": "someone@example.com",
      "updated_at": 1656112029355,
      "updated_by": "someone@example.com",
      "catalog_type": "MANAGED_CATALOG"
    },
    {
      "...": "..."
    }
  ]
}

取得目錄的相關信息

若要顯示使用方式檔,請執行 databricks unity-catalog catalogs get --help

databricks unity-catalog catalogs get --name my-catalog

輸出:

{
  "name": "my-catalog",
  "owner": "someone@example.com",
  "metastore_id": "12a345b6-7890-1cd2-3456-e789f0a12b34",
  "created_at": 1656113178995,
  "created_by": "someone@example.com",
  "updated_at": 1656113178995,
  "updated_by": "someone@example.com",
  "catalog_type": "MANAGED_CATALOG"
}

刪除目錄

若要顯示使用方式檔,請執行 databricks unity-catalog catalogs delete --help。 另 請參閱刪除目錄

若要強制刪除目錄,請使用 --purge 選項。

databricks unity-catalog catalogs delete --name my-catalog

如果作業成功,則不會傳回任何結果。

結構描述

unity-catalog schemas使用子命令來處理架構

若要顯示使用方式檔,請執行 databricks unity-catalog schemas --help

建立結構描述

若要顯示使用方式檔,請執行 databricks unity-catalog schemas create --help。 另 請參閱建立架構

databricks unity-catalog schemas create --catalog-name my-catalog \
                                        --name my-schema

輸出:

{
  "name": "my-schema",
  "catalog_name": "my-catalog",
  "owner": "someone@example.com",
  "metastore_id": "12a345b6-7890-1cd2-3456-e789f0a12b34",
  "full_name": "my-catalog.my-schema",
  "created_at": 1656113607800,
  "created_by": "someone@example.com",
  "updated_at": 1656113607800,
  "updated_by": "someone@example.com"
}

變更架構的設定

若要顯示使用方式檔,請執行 databricks unity-catalog schemas update --help

databricks unity-catalog schemas update --full-name my-catalog.my-schema \
                                        --json-file update-schema.json

update-schema.json

{
  "name": "my-schema-2",
  "owner": "someone@example.com"
}

輸出:

{
  "name": "my-schema-2",
  "catalog_name": "my-catalog",
  "owner": "someone@example.com",
  "comment": "Default schema (auto-created)",
  "metastore_id": "12a345b6-7890-1cd2-3456-e789f0a12b34",
  "full_name": "my-catalog.my-schema-2",
  "created_at": 1656355967837,
  "created_by": "someone@example.com",
  "updated_at": 1656356592786,
  "updated_by": "someone@example.com"
}

列出可用的架構

若要顯示使用方式檔,請執行 databricks unity-catalog schemas list --help

databricks unity-catalog schemas list --catalog-name my-catalog

輸出:

{
  "schemas": [
    {
      "name": "default",
      "catalog_name": "my-catalog",
      "owner": "someone@example.com",
      "comment": "Default schema (auto-created)",
      "metastore_id": "12a345b6-7890-1cd2-3456-e789f0a12b34",
      "full_name": "my-catalog.default",
      "created_at": 1656113178996,
      "created_by": "someone@example.com",
      "updated_at": 1656113178996,
      "updated_by": "someone@example.com"
    },
    {
      "...": "..."
    }
  ]
}

取得架構的相關信息

若要顯示使用方式檔,請執行 databricks unity-catalog schemas get --help

databricks unity-catalog schemas get --full-name my-catalog.my-schema

輸出:

{
  "name": "my-schema",
  "catalog_name": "my-catalog",
  "owner": "someone@example.com",
  "metastore_id": "12a345b6-7890-1cd2-3456-e789f0a12b34",
  "full_name": "my-catalog.my-schema",
  "created_at": 1656113607800,
  "created_by": "someone@example.com",
  "updated_at": 1656113607800,
  "updated_by": "someone@example.com"
}

刪除結構描述

若要顯示使用方式檔,請執行 databricks unity-catalog schemas delete --help。 另 請參閱刪除架構

若要強制刪除架構,請使用 --purge 選項。

databricks unity-catalog schemas delete --full-name my-catalog.my-schema

如果作業成功,則不會傳回任何結果。

資料表

unity-catalog tables使用子命令來處理數據表

注意

不支援使用 Unity 目錄 CLI 建立資料表。 若要建立數據表,請參閱 什麼是數據表?教學課程:建立您的第一個數據表並授與許可權

若要顯示使用方式檔,請執行 databricks unity-catalog tables --help

列出可用的數據表

若要顯示使用方式檔,請執行 databricks unity-catalog tables list --help

databricks unity-catalog tables list --catalog-name main \
                                     --schema-name default

列出可用數據表的摘要

若要顯示使用方式檔,請執行 databricks unity-catalog tables list-summaries --help

databricks unity-catalog tables list-summaries --catalog-name main

輸出:

{
  "tables": [
    {
      "full_name": "main.default.mytable",
      "table_type": "MANAGED"
    },
    {
      "...": "..."
    }
  ]
}

取得數據表的相關信息

若要顯示使用方式檔,請執行 databricks unity-catalog tables get --help

databricks unity-catalog tables get --full-name main.default.mytable

刪除資料表

若要顯示使用方式檔,請執行 databricks unity-catalog tables delete --help

databricks unity-catalog tables delete --full-name main.default.mytable

如果作業成功,則不會傳回任何結果。

血統

unity-catalog lineage使用子命令來處理數據表和數據行譜系。

若要顯示使用方式檔,請執行 databricks unity-catalog lineage --help

列出數據表的譜系

若要顯示使用方式檔,請執行 databricks unity-catalog lineage table --help

databricks unity-catalog lineage table --table-name main.default.mytable \
                                       --level 1

列出數據行譜系

若要顯示使用方式檔,請執行 databricks unity-catalog lineage column --help

databricks unity-catalog lineage column --table-name main.default.mytable \
                                        --column-name id

權限

unity-catalog permissions使用子命令來處理安全性實體對象的許可權。 另 請參閱在 Unity 目錄中管理許可權。

若要顯示使用方式檔,請執行 databricks unity-catalog permissions --help

取得安全性實體物件許可權的相關信息

若要顯示使用方式檔,請執行 databricks unity-catalog permissions get --help。 另 請參閱 Unity 目錄許可權和安全性實體物件

目錄

databricks unity-catalog permissions get --catalog main

輸出:

{
  "privilege_assignments": [
    {
      "principal": "account users",
      "privileges": [
        "USE CATALOG"
      ]
    }
  ]
}

結構描述

databricks unity-catalog permissions get --schema main.default

輸出:

{
  "privilege_assignments": [
    {
      "principal": "account users",
      "privileges": [
        "USE SCHEMA"
      ]
    }
  ]
}

Table

databricks unity-catalog permissions get --table main.default.mytable

輸出:

{
  "privilege_assignments": [
    {
      "principal": "account users",
      "privileges": [
        "SELECT"
      ]
    }
  ]
}

儲存體認證

databricks unity-catalog permissions get --storage-credential my-storage-root-credential

輸出:

{
  "privilege_assignments": [
    {
      "principal": "account users",
      "privileges": [
        "READ_FILES"
      ]
    }
  ]
}

外部位置

databricks unity-catalog permissions get --external-location my-external-location

輸出:

{
  "privilege_assignments": [
    {
      "principal": "account users",
      "privileges": [
        "READ_FILES"
      ]
    }
  ]
}

更新安全性實體對象的許可權

若要顯示使用方式檔,請執行 databricks unity-catalog permissions update --help。 另 請參閱 Unity 目錄許可權和安全性實體物件

目錄

databricks unity-catalog permissions update --catalog \
                                            --json-file update-catalog-permissions.json

update-catalog-permissions.json

{
  "changes": [
    {
      "principal": "account users",
      "add": [ "USE CATALOG" ],
      "remove": [ "CREATE SCHEMA" ]
    }
  ]
}

結構描述

databricks unity-catalog permissions update --schema \
                                            --json-file update-schema-permissions.json

update-schema-permissions.json

{
  "changes": [
    {
      "principal": "account users",
      "add": [ "USE SCHEMA" ],
      "remove": [ "CREATE TABLE" ]
    },
    {
      "principal": "admin team",
      "add": [ "CREATE TABLE" ]
    }
  ]
}

Table

databricks unity-catalog permissions update --table \
                                            --json-file update-table-permissions.json

update-table-permissions.json

{
  "changes": [
    {
      "principal": "account users",
      "add": [ "SELECT" ],
      "remove": [ "MODIFY" ]
    },
    {
      "principal": "admin team",
      "add": [ "ALL" ]
    }
  ]
}

儲存體認證

databricks unity-catalog permissions update --storage-credential \
                                            --json-file update-storage-credential-permissions.json

update-storage-credential-permissions.json

{
  "changes": [
    {
      "principal": "account users",
      "remove": [ "READ FILES" ]
    },
    {
      "principal": "storage team",
      "add": [ "READ FILES",
               "WRITE FILES",
               "CREATE EXTERNAL TABLE"
             ]
    },
    {
      "principal": "admin team",
      "add": [ "ALL" ]
    }
  ]
}

外部位置

databricks unity-catalog permissions update --external-location \
                                            --json-file update-external-location-permissions.json

update-external-location-permissions.json

{
  "changes": [
    {
      "principal": "account users",
      "remove": [ "READ FILES" ]
    },
    {
      "principal": "storage team",
      "add": [ "READ FILES",
               "WRITE FILES",
               "CREATE EXTERNAL TABLE"
             ]
    },
    {
      "principal": "admin team",
      "add": [ "ALL" ]
    }
  ]
}

分享次數

unity-catalog shares使用子命令來處理共用,這些物件包含 Delta Sharing 已啟用 Unity 目錄中繼存放區中數據表集合的物件,您想要與 Delta Sharing 收件者共用為群組。 共用只能包含單一中繼存放區的數據表。 請參閱 建立和管理差異共用的共用。

若要顯示使用方式檔,請執行 databricks unity-catalog shares --help

建立共用

若要顯示使用方式檔,請執行 databricks unity-catalog shares create --help。 另 請參閱建立和管理差異共用的共用。

databricks unity-catalog shares create --name my-share

輸出:

{
  "name": "my-share",
  "created_at": 1656433327533,
  "created_by": "someone@example.com",
  "owner": "someone@example.com"
}

更新共享的設定

若要顯示使用方式檔,請執行 databricks unity-catalog shares update --help。 另 請參閱更新共用

將數據表新增至共用

databricks unity-catalog shares update --name my-share \
                                       --add-table main.default.mytable

輸出:

{
  "name": "my-share",
  "objects": [
    {
      "name": "main.default.mytable",
      "data_object_type": "TABLE",
      "added_at": 1656434168847,
      "added_by": "someone@example.com",
      "shared_as": "default.mytable",
      "cdf_enabled": false
    }
  ],
  "created_at": 1656433327533,
  "created_by": "someone@example.com",
  "owner": "someone@example.com"
}

請參閱將數據表新增至共用

從共用移除數據表

databricks unity-catalog shares update --name my-share \
                                       --remove-table main.default.mytable

輸出:

{
  "name": "my-share",
  "created_at": 1656433327533,
  "created_by": "someone@example.com",
  "owner": "someone@example.com"
}

請參閱將數據表新增至共用

更新共享的許可權

若要顯示使用方式檔,請執行 databricks unity-catalog shares update-permissions --help。 另請參閱管理對 Delta Sharing 數據共用的存取權(適用於提供者)。

databricks unity-catalog shares update-permissions --name my-share \
                                                   --json-file update-share-permissions.json

update-share-permissions.json

{
  "privilege_assignments": [
    {
      "principal": "my-recipient",
      "privileges": [
        "SELECT"
      ]
    }
  ]
}

列出可用的共用

若要顯示使用方式檔,請執行 databricks unity-catalog shares list --help。 另 請參閱檢視共用和共用詳細數據

databricks unity-catalog shares list

輸出:

{
  "shares": [
    {
      "name": "my-share",
      "created_at": 1656433327533,
      "created_by": "someone@example.com",
      "owner": "someone@example.com"
    },
    {
      "...": "..."
    }
  ]
}

取得共用的相關信息

若要顯示使用方式檔,請執行 databricks unity-catalog shares get --help。 另 請參閱檢視共用和共用詳細數據

databricks unity-catalog shares get --name my-share

輸出:

{
  "name": "my-share",
  "created_at": 1656433327533,
  "created_by": "someone@example.com",
  "owner": "someone@example.com"
}

列出共享的許可權

若要顯示使用方式檔,請執行 databricks unity-catalog shares list-permissions --help。 另 請參閱檢視具有共享許可權的收件者。

databricks unity-catalog shares list-permissions --name my-share

輸出:

{
  "privilege_assignments": [
    {
      "principal": "my-recipient",
      "privileges": [
        "SELECT"
      ]
    }
  ]
}

刪除共用

若要顯示使用方式檔,請執行 databricks unity-catalog shares delete --help。 另 請參閱刪除共用

databricks unity-catalog shares delete --name my-share

如果作業成功,則不會傳回任何結果。

收件者

unity-catalog recipients使用子命令來處理已啟用差異共用之 Unity 目錄中繼存放區的數據收件者。 數據收件者是 Azure Databricks 使用者與 Azure Databricks 用戶組織外部共用數據的人員或群組。 請參閱 建立和管理差異共享的數據收件者。

若要顯示使用方式檔,請執行 databricks unity-catalog recipients --help

建立收件者

若要顯示使用方式檔,請執行 databricks unity-catalog recipients create --help。 另 請參閱建立和管理差異共享的數據收件者。

若要為收件者產生新的啟用 URL 請執行 databricks unity-catalog recipients rotate-token。 如需範例,請參閱 輪替收件者的令牌

databricks unity-catalog recipients create --name my-recipient

輸出:

{
  "name": "my-recipient",
  "created_at": 1656435288003,
  "created_by": "someone@example.com",
  "tokens": [
    {
      "id": "12a345b6-7890-1cd2-3456-e789f0a12b34",
      "created_at": 1656435288005,
      "created_by": "someone@example.com",
      "activation_url": "https://example.com/delta_sharing/retrieve_config.html?<unique-id>",
      "expiration_time": 1656521688006,
      "updated_at": 1656435288006,
      "updated_by": "someone@example.com"
    }
  ],
  "authentication_type": "TOKEN",
  "updated_at": 1656435288003,
  "updated_by": "someone@example.com",
  "owner": "someone@example.com"
}

變更收件者的設定

若要顯示使用方式檔,請執行 databricks unity-catalog recipients update --help

databricks unity-catalog recipients update --name my-recipient \
                                           --json-file update-recipient-settings.json

update-recipient-settings.json

{
  "name": "my-recipient-2"
}

輸出:

{
  "name": "my-recipient-2",
  "created_at": 1656435288003,
  "created_by": "someone@example.com",
  "tokens": [
    {
      "id": "12a345b6-7890-1cd2-3456-e789f0a12b34",
      "created_at": 1656435288005,
      "created_by": "someone@example.com",
      "expiration_time": 1656436808507,
      "updated_at": 1656435908507,
      "updated_by": "someone@example.com"
    },
    {
      "id": "12a345b6-7890-1cd2-3456-e789f0a12b34",
      "created_at": 1656435908509,
      "created_by": "someone@example.com",
      "activation_url": "https://example.com/delta_sharing/retrieve_config.html?<unique-id>",
      "expiration_time": 1656522308510,
      "updated_at": 1656435908510,
      "updated_by": "someone@example.com"
    }
  ],
  "authentication_type": "TOKEN",
  "updated_at": 1656436740986,
  "updated_by": "someone@example.com",
  "owner": "someone@example.com"
}

輪替收件者的令牌

若要顯示使用方式檔,請執行 databricks unity-catalog recipients rotate-token --help。 另請參閱管理收件者令牌(開啟共用)。

databricks unity-catalog recipients rotate-token --name my-recipient \
                                                 --existing-token-expire-in-seconds 900

輸出:

{
  "name": "my-recipient",
  "created_at": 1656435288003,
  "created_by": "someone@example.com",
  "tokens": [
    {
      "id": "12a345b6-7890-1cd2-3456-e789f0a12b34",
      "created_at": 1656435288005,
      "created_by": "someone@example.com",
      "expiration_time": 1656436808507,
      "updated_at": 1656435908507,
      "updated_by": "someone@example.com"
    },
    {
      "id": "12a345b6-7890-1cd2-3456-e789f0a12b34",
      "created_at": 1656435908509,
      "created_by": "someone@example.com",
      "activation_url": "https://example.com/delta_sharing/retrieve_config.html?<unique-id>",
      "expiration_time": 1656522308510,
      "updated_at": 1656435908510,
      "updated_by": "someone@example.com"
    }
  ],
  "authentication_type": "TOKEN",
  "updated_at": 1656435288003,
  "updated_by": "someone@example.com",
  "owner": "someone@example.com"
}

列出可用的收件者

若要顯示使用方式檔,請執行 databricks unity-catalog recipients list --help。 另 請參閱檢視收件者

databricks unity-catalog recipients list

輸出:

{
  "recipients": [
    {
      "name": "my-recipient",
      "created_at": 1656435288003,
      "created_by": "someone@example.com",
      "tokens": [
        {
          "id": "12a345b6-7890-1cd2-3456-e789f0a12b34",
          "created_at": 1656435288005,
          "created_by": "someone@example.com",
          "activation_url": "https://example.com/delta_sharing/retrieve_config.html?<unique-id>",
          "expiration_time": 1656521688006,
          "updated_at": 1656435288006,
          "updated_by": "someone@example.com"
        }
      ],
      "authentication_type": "TOKEN",
      "updated_at": 1656435288003,
      "updated_by": "someone@example.com",
      "owner": "someone@example.com"
    }
  ]
}

列出收件者的共享許可權

若要顯示使用方式檔,請執行 databricks unity-catalog recipients list-permissions --help。 另 請參閱檢視收件者的共享許可權

databricks unity-catalog recipients list-permissions --name my-recipient

輸出:

{
  "permissions_out": [
    {
      "share_name": "my-share",
      "privilege_assignments": [
        {
          "privileges": [
            "SELECT"
          ]
        }
      ]
    }
  ]
}

取得收件者的相關信息

若要顯示使用方式檔,請執行 databricks unity-catalog recipients get --help。 另 請參閱檢視收件者詳細數據

databricks unity-catalog recipients get --name my-recipient

輸出:

{
  "name": "my-recipient",
  "created_at": 1656435288003,
  "created_by": "someone@example.com",
  "tokens": [
    {
      "id": "12a345b6-7890-1cd2-3456-e789f0a12b34",
      "created_at": 1656435288005,
      "created_by": "someone@example.com",
      "activation_url": "https://example.com/delta_sharing/retrieve_config.html?<unique-id>",
      "expiration_time": 1656521688006,
      "updated_at": 1656435288006,
      "updated_by": "someone@example.com"
    }
  ],
  "authentication_type": "TOKEN",
  "updated_at": 1656435288003,
  "updated_by": "someone@example.com",
  "owner": "someone@example.com"
}

刪除收件者

若要顯示使用方式檔,請執行 databricks unity-catalog recipients delete --help。 另 請參閱刪除收件者

databricks unity-catalog recipients delete --name my-recipient

如果作業成功,則不會傳回任何結果。

提供者

如果您是 Delta Sharing 共用數據收件者,請使用 unity-catalog providers 子命令來處理 Delta Sharing 資料提供者。 請參閱管理差異共用提供者(適用於數據收件者)。

若要顯示使用方式檔,請執行 databricks unity-catalog providers --help

建立提供者

如果您是使用 開啟共用通訊協定 共用的數據收件者,而且您使用附加至 Unity 目錄中繼存放區的 Databricks 工作區,您可以在 Unity 目錄中繼存放區中建立提供者物件。 然後,您可以使用 Unity 目錄來管理共用資料的存取權。

重要

此案例很少見。 如果您使用已啟用 Unity 目錄的 Databricks 工作區,而另一個 Databricks 客戶會與您共用數據,他們應該使用 Databricks 對 Databricks 共用。 使用 Databricks 對 Databricks 共用時,會在 Unity 目錄中為您建立提供者物件。

若要建立提供者,您必須:

  • 是具有 CREATE_PROVIDER 中繼存放區許可權的中繼存放區管理員或使用者。
  • 可以存取下載的認證檔案。 請參閱 在開放式共用模型中取得存取權。

執行下列命令,將 取代為您想要提供給提供者的名稱,並以config.share您下載認證檔案的路徑取代my-provider,預設名為 config.share。

databricks unity-catalog providers create --name my-provider  \
                  --recipient-profile-json-file config.share

更新提供者的設定

若要顯示使用方式檔,請執行 databricks unity-catalog providers update --help

databricks unity-catalog providers update --name my-provider \
                                          --new-name my-provider-2

列出可用的提供者

若要顯示使用方式檔,請執行 databricks unity-catalog providers list --help

databricks unity-catalog providers list

取得提供者的相關信息

若要顯示使用方式檔,請執行 databricks unity-catalog providers get --help

databricks unity-catalog providers get --name my-provider

列出提供者的可用共用

若要顯示使用方式檔,請執行 databricks unity-catalog providers list-shares --help

databricks unity-catalog providers list-shares --name my-provider

刪除提供者

若要顯示使用方式檔,請執行 databricks unity-catalog providers delete --help

databricks unity-catalog providers delete --name my-provider

如果作業成功,則不會傳回任何結果。