gerenciar conexões para a lakehouse Federation
Este artigo descreve como listar todas as conexões da Lakehouse Federation definidas em um metastore Unity Catalog, obter detalhes da conexão, conceder permissões de conexão e descartar conexões usando o Catalog Explorer e as instruções SQL no Notebook ou no editor de consultas Databricks SQL. Uma conexão é um objeto seguro no Unity Catalog que especifica um caminho e credenciais para acessar um sistema de banco de dados externo.
Consulte também Criar uma conexão.
Se o senhor preferir usar a API REST, consulte a documentação de referência da Databricks.
Listar conexões
Permissões necessárias : a lista de conexões retornadas depende de sua função e permissões. Usuários com o privilégio USE CONNECTION
no metastore veem todas as conexões. Caso contrário, o senhor pode view apenas as conexões das quais é o proprietário do objeto de conexão ou tem algum privilégio.
- Catalog Explorer
- SQL
-
In your Databricks workspace, click
Catalog.
-
At the top of the Catalog pane, click the
gear icon and select Connections from the menu.
Alternatively, from the Quick access page, click the External data > button and go to the Connections tab.
The connections you have permission to see are listed, along with the URL, create date, owner, and comment.
Run the following command in a notebook or the Databricks SQL query editor. Optionally, replace <pattern>
with a LIKE
predicate.
SHOW CONNECTIONS [LIKE <pattern>];
Obtenha detalhes da conexão
Permissões necessárias : proprietário da conexão, privilégio USE CONNECTION
na metastore ou algum privilégio na conexão.
- Catalog Explorer
- SQL
-
In your Databricks workspace, click
Catalog.
-
At the top of the Catalog pane, click the
gear icon and select Connections from the menu.
Alternatively, from the Quick access page, click the External data > button and go to the Connections tab.
-
Find the connection and select it to view details.
Run the following command in a notebook or the Databricks SQL query editor.
DESCRIBE CONNECTION <connection-name>;
Conceder e revogar permissões em conexões
O senhor pode conceder permissão para usar uma conexão para criar catálogos estrangeiros ou para view detalhes sobre uma conexão:
CREATE FOREIGN CATALOG
concede a capacidade de criar um catálogo externo como um espelho somente leitura de um banco de dados na fonte de dados descrita pela conexão.USE CONNECTION
concede a capacidade de usar a conexão no DLT para ingerir dados da fonte de dados em Databricks. No entanto, se concedido no nível do metastore, ele só permite visualizar os detalhes das conexões no metastore. Os usuários ainda precisam receberUSE CONNECTION
em conexões individuais para usá-las.
Permissões necessárias : administrador do Metastore ou proprietário da conexão.
- Catalog Explorer
- SQL
To grant permission to use a connection:
-
In your Databricks workspace, click
Catalog.
-
At the top of the Catalog pane, click the
gear icon and select Connections from the menu.
Alternatively, from the Quick access page, click the External data > button and go to the Connections tab.
-
Find the connection and select it.
-
On the Permissions tab, click Grant.
-
On the Grant on
<connection-name>
dialog, start typing the user or group name or click the user menu to browse and select users and groups. -
Select the privileges you want to grant.
See the privilege descriptions in the section introduction.
-
Click Grant.
To revoke a connection privilege:
- Follow the preceding steps to get to the Permissions tab for the connection.
- Select the user or group whose privilege you want to revoke.
- Click Revoke both on the tab and on the confirmation dialog.
To grant the ability to create a foreign catalog using a connection, run the following command in a notebook or the Databricks SQL query editor.
GRANT CREATE FOREIGN CATALOG ON CONNECTION <connection-name> TO <user-name>;
To grant the ability to view the connection, run the following:
GRANT USE CONNECTION ON CONNECTION <connection-name> TO <user-name>;
To revoke a privilege, run the following, where <privilege>
is one of the privileges on the connection granted to the user:
REVOKE <privilege> ON CONNECTION <connection-name> FROM <user-name>;
Descarte conexões
Permissões necessárias : Proprietário da conexão
- Catalog Explorer
- SQL
-
In your Databricks workspace, click
Catalog.
-
At the top of the Catalog pane, click the
gear icon and select Connections from the menu.
Alternatively, from the Quick access page, click the External data > button and go to the Connections tab.
-
Find the connection and select it.
-
Click the
kebab menu and select Delete.
-
On the confirmation dialog, click Delete.
Run the following command in a notebook or the Databricks SQL query editor.
DROP CONNECTION [IF EXISTS] <connection-name>;