若要使用 Data Catalog,您必须在 Google Cloud
项目中启用 Data Catalog API,该项目包含您将在 Data Catalog 中创建的资源,或包含您将使用 API 访问的其他 Google Cloud 系统中的资源。我们将此项目称为 Data Catalog“资源项目”。
在一般情况下,如果您只有一个项目,则只需在其中启用 Data Catalog API 即可访问其中包含的所有资源。Data Catalog 快速入门是一个创建项目的示例,其中启用了 Data Catalog API 并包含您访问的 BigQuery 表以及 Data Catalog 标记模板和标记。
在多个项目中使用标记模板
Google Cloud 中的所有内容均属于项目,包括标记模板。但是,如果您已授权另一个项目使用模板,则可以使用一个项目中的标记模板在另一个项目中创建标记。为此,请使用 TagTemplate Owner、Creator、User 和 Viewer IAM 角色。
例如:如果项目 A 向项目 B 拥有的服务账号授予 TagTemplate User 角色,那么项目 B 便可以使用其模板创建标记。项目 A 也可以授权同一服务账号使用 Tag Editor 角色修改已创建的标记。
如果项目 A 未向项目 B 授权,项目 B 就无法使用项目 A 的标记模板标记自己的数据资源,它必须创建自己的模板。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-02-01。"],[[["\u003cp\u003eThe Data Catalog API must be enabled in a Google Cloud project, referred to as the "resource project," to create resources in Data Catalog or access them in other Google Cloud systems.\u003c/p\u003e\n"],["\u003cp\u003eTag templates, although created within a specific project, can be used to create tags in other projects if the appropriate IAM roles (\u003ccode\u003eTagTemplate Owner\u003c/code\u003e, \u003ccode\u003eCreator\u003c/code\u003e, \u003ccode\u003eUser\u003c/code\u003e, and \u003ccode\u003eViewer\u003c/code\u003e) are granted.\u003c/p\u003e\n"],["\u003cp\u003eThe project hosting the tag template is responsible for billing, even if the tags are utilized by other projects.\u003c/p\u003e\n"],["\u003cp\u003eFor optimal management, it's a best practice to create tag templates in a centralized project if they're intended for use across multiple projects, and a data governance team should manage them.\u003c/p\u003e\n"],["\u003cp\u003eThe necessary project in which the Data Catalog API must be enabled varies according to which Data Catalog APIs are being utilized, such as \u003ccode\u003eget/lookup/search\u003c/code\u003e vs.\u003ccode\u003ecreate/update/delete\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Data Catalog resource projects\n\nTo use Data Catalog, you must\n[enable the Data Catalog API](/apis/docs/enable-disable-apis#enable_an_api)\nin a Google Cloud\n[project](/resource-manager/docs/cloud-platform-resource-hierarchy#projects)\nthat contains the resources you will create in Data Catalog or\naccess in other Google Cloud systems with the API. We refer\nto this project as the Data Catalog \"resource project\".\n\nIn the common case, if you have only one project, you only need to enable\nthe Data Catalog API in it to access all the resources it contains.\nThe [Data Catalog quickstart](/data-catalog/docs/quickstarts/quickstart-search-tag)\nis an example of the creation of a project that has the Data Catalog\nAPI enabled and contains a BigQuery table you access as well as a\nData Catalog tag template and tag.\n\n### Using tag templates in multiple projects\n\nEverything in Google Cloud lives in a project, including your tag\ntemplates. However, you can use tag templates from one project to create tags in\nanother if you authorize the other project to use the templates.\nTo do this, use the `TagTemplate Owner`, `Creator`, `User`, and `Viewer` IAM\nroles.\n\nFor example: If project A grants the `TagTemplate User` role to a service\naccount owned by project B, this authorizes project B to create tags using its\ntemplates. Project A can also authorize the same service account to modify the\ncreated tags using the `Tag Editor` role.\n\nIf project A does not authorize project B, project B cannot tag its own data\nresources using project A's tag templates---it must create its own templates.\n| **Important:** The project that hosts your tag template is billed for tags created from it, even if they are used by other projects.\n\n**Best practice:** Create templates in a central project\nif they are relevant to more than one project. Also, your data governance team\nshould own the shared tag templates and maintain them on behalf of the\norganization.\n\n### Identifying the Data Catalog resource project\n\nThe following table lists Data Catalog APIs and the\nassociated resource project(s) where Data Catalog\nAPI must be enabled.\n\n**Notes:**\n\n- `service account project`: the project in which you have generated\n [service account credentials](/iam/docs/service-account-overview#what-are-service-accounts)\n to authenticate your application code.\n\n- `resource parameter`: the parameter passed in the API request that\n identifies the resource associated with the request (for example, see `project-id` in the\n [tagTemplates.create](/data-catalog/docs/reference/rest/v1beta1/projects.locations.tagTemplates/create)\n `parent` parameter).\n\nWhat's next\n-----------\n\n- Follow [Getting started with Data Catalog](/data-catalog/docs/quickstarts/quickstart-search-tag)."]]