CREATE GATEWAY¶
Creates a new gateway in the current schema. A gateway enables traffic splitting across multiple service endpoints.
- See also:
ALTER GATEWAY , DESCRIBE GATEWAY, DROP GATEWAY , SHOW GATEWAYS
语法
必填参数
name指定网关标识符的字符串;对于在网关中创建任务的架构,必须是唯一的。
FROM SPECIFICATION指定内联网关规范。该规范定义了流量拆分配置。
该规范使用以下格式:
规范参数
typeFixed value. Must be set to
traffic_split.split_typeFixed value. Must be set to
custom.targets要将流量路由到的目标端点列表。每个目标必须指定:
typeFixed value. Must be set to
endpoint.valueThe fully qualified endpoint name in the format
db.schema.service!endpoint. Each target endpoint must exist.weight此端点的流量权重,指定为整数。所有权重之和必须为 100。
Note
- 默认情况下,每个网关的最大端点数为 5。
访问控制要求
A role used to execute this operation must have the following privileges at a minimum:
| 权限 | 对象 | 备注 |
|---|---|---|
| CREATE GATEWAY | 架构 | 在架构中创建网关时需要。 |
| BIND SERVICE ENDPOINT | 账户 | 将服务端点绑定到网关时需要。 |
| USAGE | 数据库 | 对于包含网关的数据库是必需的。 |
| USAGE | 架构 | 对于包含网关的架构是必需的。 |
| USAGE | 服务端点 | Required on the target service endpoints. Grant the service role ALL_ENDPOINTS_USAGE to provide access. |
要授予所需权限,请使用以下命令:
For instructions on creating a custom role with a specified set of privileges, see Creating custom roles.
For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.
使用说明
-
关于元数据:
Attention
Customers should ensure that no personal data (other than for a User object), sensitive data, export-controlled data, or other regulated data is entered as metadata when using the Snowflake service. For more information, see Metadata fields in Snowflake.
示例
创建在两个服务端点之间拆分流量的网关:
使用新的流量拆分配置创建或替换网关: