Unity Catalog 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 Catalog CLI 是实验性的

Unity Catalog CLI 需要 Databricks CLI(旧版) 0.17.0 或更高版本,并已配置身份验证。 若要更新 Databricks CLI 或列出已安装的版本,请参阅更新 CLI

以下示例中的选项和字段示例值仅用于说明目的。

使用 Unity Catalog CLI 处理:

  • Unity Catalog 资源,例如元存储、存储凭据、外部位置、目录、架构、表及其权限。
  • Delta Sharing 资源,例如共享、接收者和提供程序。

可将 Unity Catalog CLI 子命令追加到 databricks unity-catalog 后面来运行这些子命令。 这些子命令调用 Unity Catalog API,其中还包括 Delta Sharing 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 Catalog 元存储

注意

创建元存储不会自动将元存储与工作区或存储凭据相关联。 若要完成这些任务,请参阅将元存储与工作区关联创建存储凭据更新元存储的设置

如果在已分配元存储的工作区上运行此命令,则会更新该工作区的分配元存储。

若要显示使用情况文档,请运行 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

若要获取工作区 ID,请参阅工作区实例名称、URL 和 ID

若要获取元存储 ID,请运行 databricks unity-catalog metastores get-summary。 有关示例,请参阅获取有关当前元存储的汇总信息

输出:

{}

另请参阅创建 Unity Catalog 元存储

更新元存储的设置

若要显示使用情况文档,请运行 databricks unity-catalog metastores update --help

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

若要获取元存储 ID,请运行 databricks unity-catalog metastores get-summary。 有关示例,请参阅获取有关当前元存储的汇总信息

update-metastore.json

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

若要获取存储根凭据 ID,请参阅获取有关存储凭据的信息

列出可用元存储

若要显示使用情况文档,请运行 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

若要获取元存储 ID,请运行 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

若要获取工作区 ID,请参阅工作区实例名称、URL 和 ID

若要获取元存储 ID,请运行 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

若要获取元存储 ID,请运行 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 Catalog 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 Catalog 中管理权限

若要显示使用情况文档,请运行 databricks unity-catalog permissions --help

获取有关安全对象权限的信息

若要显示使用情况文档,请运行 databricks unity-catalog permissions get --help。 另请参阅 Unity Catalog 权限和安全对象

目录

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"
      ]
    }
  ]
}

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 Catalog 权限和安全对象

目录

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" ]
    }
  ]
}

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 Catalog 元存储中要以组形式与 Delta Sharing 接收者共享的表的集合。 一个共享只能包含一个元存储中的表。 请参阅创建和管理 Delta Sharing 的共享

若要显示使用情况文档,请运行 databricks unity-catalog shares --help

创建共享

若要显示使用情况文档,请运行 databricks unity-catalog shares create --help。 另请参阅创建和管理 Delta Sharing 的共享

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 子命令处理已启用 Delta Sharing 的 Unity Catalog 元存储的数据接收者。 数据接收者是指 Azure Databricks 用户与之共享数据的 Azure Databricks 用户组织外部人员或组。 请参阅创建和管理 Delta Sharing 的数据接收者

若要显示使用情况文档,请运行 databricks unity-catalog recipients --help

创建接收者

若要显示使用情况文档,请运行 databricks unity-catalog recipients create --help。 另请参阅创建和管理 Delta Sharing 的数据接收者

若要为接收者生成新的激活 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 数据提供程序。 请参阅 管理(数据接收者的)Delta Sharing 提供程序

若要显示使用情况文档,请运行 databricks unity-catalog providers --help

创建提供程序

如果你是使用开放共享协议共享数据的接收者,并且使用的是附加到 Unity Catalog 元存储的 Databricks 工作区,则可以在 Unity Catalog 元存储中创建提供程序对象。 然后,可以使用 Unity Catalog 管理对共享数据的访问权限。

重要

这种情况很少发生。 如果你正在使用为 Unity 目录启用的 Databricks 工作区,而另一个 Databricks 客户正在向你共享数据,则其应该使用 Databricks 到 Databricks 共享。 使用 Databricks 到 Databricks 共享,在 Unity 目录中创建提供程序对象。

若要创建提供程序,必须:

运行以下命令,将 my-provider 替换为要提供给提供程序的名称,并将 config.share 替换为下载的凭据文件的路径(默认情况下名为 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

如果操作成功,则不返回任何结果。