Snowflake High Performance connector for Kafka:选择使用 时默认使用的角色和仓库。配置 Snowflake¶
本主题介绍了为 Snowflake High Performance connector for Kafka 配置 Snowflake 的步骤。
Snowflake 建议您为每个 Kafka 实例创建单独的用户(使用 CREATE USER)和角色(使用 CREATE ROLE),以便在需要时单独撤销访问权限。
创建角色以使用 Kafka Connector¶
以下内容可用于创建一个自定义角色供 Kafka Connector 使用,例如 KAFKA_CONNECTOR_ROLE。该脚本引用了特定的 现有 数据库和架构 (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;
-- Grant privileges on the database.
GRANT USAGE ON DATABASE kafka_db TO ROLE kafka_connector_role;
-- Grant privileges on the schema.
GRANT USAGE ON SCHEMA kafka_schema TO ROLE kafka_connector_role;
-- 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;
-- Grant INSERT on the table to insert data into.
GRANT INSERT ON TABLE kafka_schema.existing_table TO ROLE kafka_connector_role;
-- Grant the custom role to the user configured in the Kafka connector configuration properties.
GRANT ROLE kafka_connector_role TO USER kafka_connector_user;
请注意,任何权限必须直接授予连接器使用的角色。权限不能从角色层次结构中继承。
有关创建自定义角色和角色层次结构的更多信息,请参阅 配置访问控制。
所需权限¶
连接器需要以下权限才能创建和管理 Snowflake 对象:
对象 |
权限 |
需要时 |
|---|---|---|
数据库 |
USAGE |
始终需要 |
架构 |
USAGE |
始终需要 |
管道 |
OPERATE |
如果使用用户定义的管道 |
目标表 |
INSERT |
始终需要 |