Pular para o conteúdo principal

Crie catálogos

Este artigo mostra como criar catálogos em Unity Catalog. Um catálogo contém esquemas (bancos de dados), e um esquema contém tabelas, visualizações, volumes, modelos e funções.

Para saber mais sobre catálogos, consulte O que são catálogos no Databricks?

nota

Para saber como criar um catálogo externo , um objeto do Unity Catalog que espelha um banco de dados em um sistema de dados externo, consulte Criar um catálogo externo. Consulte também gerenciar e trabalhar com catálogos estrangeiros.

Requisitos

Para criar um catálogo, independentemente do tipo de catálogo:

  • O senhor deve ser um administrador do metastore da Databricks ou ter o privilégio CREATE CATALOG no metastore.
  • O recurso compute que o senhor usa para executar um Notebook para criar um catálogo deve estar no Databricks Runtime 11.3 ou superior e deve usar um modo de acesso compatível com o Unity Catalog. Consulte Modos de acesso. SQL O armazém sempre oferece suporte ao site Unity Catalog.

Para criar um catálogo compartilhado :

Para criar um catálogo padrão :

  • Se o senhor especificar um local de armazenamento gerenciar para o catálogo, deverá ter o privilégio CREATE MANAGED STORAGE no local externo de destino.
  • Se não houver armazenamento gerenciar no nível do metastore, o senhor deverá especificar um local de armazenamento gerenciar para o catálogo.

Para criar um catálogo estrangeiro :

  • Você deve ser o proprietário da conexão usada para criar o catálogo estrangeiro ou ter o privilégio CREATE FOREIGN CATALOG na conexão.
  • O senhor deve usar o site compute em Databricks Runtime 13.1 ou acima. SQL O warehouse deve ser Pro ou sem servidor.

Para criar um catálogo, o senhor pode usar o Catalog Explorer, um comando SQL, a API REST, a CLI da Databricks ou o Terraform. Quando você cria um catálogo, dois esquemas (bancos de dados) são criados automaticamente: default e information_schema.

  1. Log in to a workspace that is linked to the metastore.

  2. Click Catalog icon Catalog.

  3. Click Catalogs below Quick access.

  4. Click Create catalog.

  5. On the Create a new catalog dialog, enter a Catalog name and select the catalog Type that you want to create:

    • Standard catalog: a securable object that organizes data and AI assets that are managed by Unity Catalog. For all use cases except Lakehouse Federation and catalogs created from Delta Sharing shares.
    • Foreign catalog: a securable object that mirrors a database in an external data system using Lakehouse Federation. See Overview of Lakehouse Federation setup.
    • Shared catalog: a securable object that organizes data and other assets that are shared with you as a Delta Sharing share. Creating a catalog from a share makes those assets available for users in your workspace to read. See What is a share?.
  6. Depending on the catalog type, specify the following options:

    • For standard catalogs: It is optional but strongly recommended that you specify a managed Storage location. You must have the CREATE MANAGED STORAGE privilege on the target external location that you use as a managed storage location. See Specify a managed storage location in Unity Catalog.

      You can optionally specify a subpath of a defined external location. If you don’t have an external location defined, you can create one by clicking Create a new external location.

important

If your workspace does not have a metastore-level storage location, you must specify a managed storage location when you create a catalog.

  • For foreign catalogs: You must select a Connection, which is a securable object in Unity Catalog that specifies a path and credentials for accessing an external database system. See Overview of Lakehouse Federation setup.

    When you’ve selected the connection, enter the name of the Database or other Databricks Catalog that you want to mirror.

    Requirements differ depending on the data source:

    • MySQL uses a two-layer namespace and therefore does not require a database name.
    • For connections to a catalog in another Databricks workspace, enter the Databricks Catalog name instead of a database name.

    If you don’t have a connection defined, you can create one by clicking Create a new connection.

  • For shared catalogs: You must select a Provider and a Share. Once you have selected the provider, you can select one of the provider’s shares.

    If you aren’t sure which provider and share you want, you might find it easier to browse or search for providers and shares using the Catalog Explorer browser. See View providers and View shares that a provider has shared with you.

  1. Click Create.

  2. On the Catalog created! dialog, click View catalog to accept the catalog as automatically configured, or click Configure catalog (recommended) to configure catalog permissions, workspace bindings, and metadata.

    If you click View catalog, the catalog will be accessible to all workspaces attached to the metastore, and the BROWSE privilege will be granted to all account users. You can skip the rest of the steps in this procedure and proceed to adding schemas to the catalog. See Create schemas.

    You can return to the catalog details page in Catalog Explorer at any time to update the owner, tags, comments, workspace bindings, permissions, and schemas.

  3. On the Configure catalog > Workspaces page, specify the workspace that the catalog is bound to.

    By default, the catalog is shared with all workspaces attached to the current metastore. If the catalog will contain data that should be restricted to specific workspaces, clear the All workspace have access option and use the Assign to workspaces button to add those workspaces. The current workspace must be included.

    After you assign a workspace, you can optionally change its default Read & Write access level to Read Only: select the workspace from the list and click the Manage Access Level button.

    For more information, see Limit catalog access to specific workspaces.

  4. Click Next to assign Permissions for your catalog.

    All account users have the BROWSE privilege by default, giving them the ability to discover catalog metadata without having read access to the data.

    To grant a privilege to a user, group, or service principal, click Grant and follow the instructions in Unity Catalog privileges and securable objects.

  5. Click Next to add optional tag and comment Metadata.

    Tags are key-value pairs that you can use to organize and categorize catalogs to simplify search and discovery of your data assets. Values are optional. See Apply tags to Unity Catalog securable objects.

    A Comment is an open-ended field that is often used to provide a description to help users discover the data assets in the catalog. See Add comments to data and AI assets.

  6. Click Save.

  7. Add schemas and data objects to the catalog.

    See Create schemas.

You can use Catalog Explorer to update the owner, tags, comments, workspace bindings, and permissions any time after you have created the catalog.

Mais informações