ALTER GATEWAY

Modifies the configuration of an existing gateway. Use this command to update the traffic split configuration for a gateway.

See also:

CREATE GATEWAY , DESCRIBE GATEWAY, DROP GATEWAY , SHOW GATEWAYS

语法

ALTER GATEWAY [ IF EXISTS ] <name>
  FROM SPECIFICATION <specification_text>

参数

name

指定要更改的网关的标识符。

If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive.

For more information, see Identifier requirements.

FROM SPECIFICATION

指定内联更新的网关规范。该规范定义了流量拆分配置。

该规范使用以下格式:

spec:
  type: traffic_split
  split_type: custom
  targets:
  - type: endpoint
    value: <db>.<schema>.<service>!<endpoint>
    weight: <weight>
  - type: endpoint
    value: <db>.<schema>.<service>!<endpoint>
    weight: <weight>

规范参数

type

Fixed value. Must be set to traffic_split.

split_type

Fixed value. Must be set to custom.

targets

要将流量路由到的目标端点列表。每个目标必须指定:

type

Fixed value. Must be set to endpoint.

value

The 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:

权限对象备注
MODIFY 或 OWNERSHIP网关更改网关配置时需要。
BIND SERVICE ENDPOINT账户将服务端点绑定到网关时需要。
USAGE数据库对于包含网关的数据库是必需的。
USAGE架构对于包含网关的架构是必需的。
USAGE服务端点对于目标服务端点是必需的。

要授予所需权限,请使用以下命令:

-- Grant MODIFY or OWNERSHIP privilege on the gateway
GRANT MODIFY ON GATEWAY <gateway_name> TO ROLE <role_name>;
-- OR
GRANT OWNERSHIP ON GATEWAY <gateway_name> TO ROLE <role_name>;

-- Grant BIND SERVICE ENDPOINT privilege on the account
GRANT BIND SERVICE ENDPOINT ON ACCOUNT TO ROLE <role_name>;

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.

示例

更改网关以更新流量拆分配置:

ALTER GATEWAY split_gateway
  FROM SPECIFICATION $$
spec:
  type: traffic_split
  split_type: custom
  targets:
  - type: endpoint
    value: db.schema.s2!ep1
    weight: 60
  - type: endpoint
    value: db.schema.s1!ep1
    weight: 40
$$;