Snowflake High Performance connector for Kafka:选择使用 时默认使用的角色和仓库。配置 Snowflake¶
本主题介绍了为 Snowflake High Performance connector for Kafka 配置 Snowflake 的步骤。
Snowflake recommends that you create a separate user, using CREATE USER and role using CREATE ROLE for each Kafka instance so that the access privileges can be individually revoked as required.
创建角色以使用 Kafka Connector¶
以下内容可用于创建一个自定义角色供 Kafka Connector 使用,例如 KAFKA_CONNECTOR_ROLE_1。该脚本引用了特定的 现有 数据库和架构 (kafka_db.kafka_schema) 以及用户 (kafka_connector_user_1):
-- Use a role that can create and manage roles and privileges.
USE ROLE securityadmin;
-- Create a Snowflake role with the privileges to work with the connector.
CREATE ROLE kafka_connector_role_1;
-- Grant privileges on the database.
GRANT USAGE ON DATABASE kafka_db TO ROLE kafka_connector_role_1;
-- Grant privileges on the schema.
GRANT USAGE ON SCHEMA kafka_schema TO ROLE kafka_connector_role_1;
-- Grant OPERATE on pipes only if you manually created them (user-defined pipe mode).
-- GRANT OPERATE ON PIPE existing_pipe1 TO ROLE kafka_connector_role_1;
-- Grant INSERT on the table to insert data into.
GRANT INSERT ON TABLE kafka_schema.existing_table TO ROLE kafka_connector_role_1;
-- Grant the custom role to the user configured in the Kafka connector configuration properties.
GRANT ROLE kafka_connector_role_1 TO USER kafka_connector_user_1;
请注意,任何权限必须直接授予连接器使用的角色。权限不能从角色层次结构中继承。
有关创建自定义角色和角色层次结构的更多信息,请参阅 配置访问控制。
所需权限¶
连接器需要以下权限才能创建和管理 Snowflake 对象:
对象 |
权限 |
需要时 |
|---|---|---|
数据库 |
USAGE |
始终需要 |
架构 |
USAGE |
始终需要 |
管道 |
OPERATE |
如果使用用户定义的管道 |
目标表 |
INSERT |
始终需要 |