DESCRIBE SERVICE

描述 Snowpark Container Services 服务 (包括作业服务)。将此命令用于服务和像作业一样运行的服务。

DESCRIBE 可以缩写为 DESC。

另请参阅:

CREATE SERVICEALTER SERVICEDROP SERVICESHOW SERVICES

语法

DESC[RIBE] SERVICE <name>
Copy

参数

name

指定要描述的服务的标识符。

如果标识符包含空格或特殊字符,则整个字符串必须放在双引号内。放在双引号内的标识符也区分大小写。

有关更多信息,请参阅 标识符要求

输出

命令输出在以下列中提供服务属性和元数据:

描述

name

Snowpark Container Services 服务名称。

status

以下各值之一,表示服务的当前状态:

  • PENDING

  • RUNNING

  • FAILED

  • DONE

  • SUSPENDING

  • SUSPENDED

  • DELETING

  • DELETED

  • INTERNAL_ERROR

database_name

在其中创建服务的数据库。

schema_name

在其中创建服务的架构。

owner

拥有服务的角色。

compute_pool

Snowflake 在其中运行服务的计算池的名称。

spec

服务规范文件。仅当您在执行命令时使用服务的所有者角色时,输出才包含此列。

dns_name

Snowflake 为服务分配的 DNS 名称,格式如下:service-name.unique-id.svc.spcs.internal

unique-id 是一个 4-8 个字符长的字母数字标识符,唯一对应于数据库架构的特定实例。要查找架构的唯一 ID,请调用 SYSTEM$GET_SERVICE_DNS_DOMAIN 函数。例如:

SELECT SYSTEM$GET_SERVICE_DNS_DOMAIN('mydb.myschema');
Copy

请注意以下事项:

  • 如果您重命名一个架构,标识符保持不变。

  • 如果您删除并重新创建一个具有相同名称的架构,标识符将会改变。

DNS 名称支持服务到服务的通信(请参阅 教程 3)。

current_instances

服务的当前实例数。

target_instances

Snowflake 确定的应运行的服务实例的目标数量。

current_instances 值与 target_instances 值不相等时,Snowflake 正在关闭或启动服务实例。

例如:

  • 假设您创建了一个服务,其中 MIN_INSTANCES = 1,MAX_INSTANCES = 3。在服务运行时,Snowflake 可能确定一个实例是不够的。在这种情况下,target_instances 的值将增加,表明 Snowflake 正在启动其他实例。

    target_instances 值也可能小于 current_instances 值,这表明 Snowflake 正在减少运行实例的数量。

  • 如果您创建服务,但计算池没有容量来满足您请求的最小实例数,则 target_instances 的值将等于 min_instances 的值。current_instances 的值将小于 target_instances 的值。

min_ready_instances

指示 Snowflake 必须至少准备好多少个服务实例,才能认为服务已准备好处理请求。

min_instances

Snowflake 应该运行的最小服务实例数。

max_instances

Snowflake 在需要时可以扩展的最大服务实例数。

auto_resume

如果为 true,则在调用服务函数或收到传入请求 (ingres) 时,Snowflake 会自动恢复已暂停的服务(请参阅 使用服务)。

external_access_integrations

与服务相关联的外部访问集成的列表。有关更多信息,请参阅 配置网络出口

created_on

服务的创建时间戳。

updated_on

服务的上次更新时间戳。

resumed_on

服务的上次恢复时间戳。

suspended_on

服务上次暂停的时间戳。suspended_on 在 Snowflake 暂停服务时设置,即使在服务恢复后也保持不变。如果 suspended_on 是 NULL,则服务从未暂停。

auto_suspend_secs

Snowflake 自动暂停服务之前处于非活动状态的秒数。如果 auto_suspend_secs 设置为 0 或从未设置,则 Snowflake 不会自动暂停服务。

comment

服务的相关注释。

owner_role_type

拥有对象的角色类型是 ROLE 或 DATABASE_ROLE。

query_warehouse

当服务容器连接到 Snowflake 以执行查询,但未显式指定要使用的仓库时,Snowflake 默认使用该仓库。

is_job

如果服务是作业服务,则为 true,否则为 false

is_async_job

如果作业服务正在异步运行,则为 true。默认情况下,Snowflake 同步执行作业服务。此列包含在 DESC SERVICE、SHOW SERVICES 和 SHOW JOB SERVICES 命令的输出中,但不在 SHOW SERVICES EXCLUDING JOBS 命令中。

spec_digest

代表服务规范内容的唯一且不可变的标识符。

为了观察 spec_digest 列的值随时间的变化,服务用户可能会定期执行 SHOW SERVICES 命令。如果服务用户注意到值发生变化,则可以推断服务已升级。

is_upgrading

如果 Snowflake 正在升级服务,则为 TRUE。

managing_object_domain

管理对象的域(例如,管理服务的笔记本的域)。如果服务不受 Snowflake 实体管理,则为 NULL。

managing_object_name

管理对象的名称(例如,管理服务的笔记本的名称)。如果服务不受 Snowflake 实体管理,则为 NULL。

访问控制要求

用于执行此操作的 角色 必须至少具有以下 权限

权限

对象

备注

Any one of these privileges: OWNERSHIP, USAGE, MONITOR or OPERATE

服务

The USAGE privilege on the parent database and schema are required to perform operations on any object in a schema. Note that a role granted any privilege on a schema allows that role to resolve the schema. For example, a role granted CREATE privilege on a schema can create objects on that schema without also having USAGE granted on that schema.

有关创建具有指定权限集的自定义角色的说明,请参阅 创建自定义角色

有关对 安全对象 执行 SQL 操作的相应角色和权限授予的一般信息,请参阅 访问控制概述

使用说明

  • To post-process the output of this command, you can use the pipe operator (->>) or the RESULT_SCAN function. Both constructs treat the output as a result set that you can query.

    The output column names for this command are generated in lowercase. If you consume a result set from this command with the pipe operator or the RESULT_SCAN function, use double-quoted identifiers for the column names in the query to ensure that they match the column names in the output that was scanned. For example, if the name of an output column is type, then specify "type" for the identifier.

示例

以下示例描述名为 my_service_with_ebs_volume 的服务:

DESCRIBE SERVICE echo_service;
Copy
+--------------+---------+---------------+-------------+-----------+-----------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------+-------------------+------------------+---------------------+---------------+---------------+-------------+------------------------------+-------------------------------+-------------------------------+------------+--------------+-------------------+---------+-----------------+-----------------+--------+--------------+------------------------------------------------------------------+--------------+------------------------+----------------------+
| name         | status  | database_name | schema_name | owner     | compute_pool          | spec                                                                                                                                                         | dns_name                            | current_instances | target_instances | min_ready_instances | min_instances | max_instances | auto_resume | external_access_integrations | created_on                    | updated_on                    | resumed_on | suspended_on | auto_suspend_secs | comment | owner_role_type | query_warehouse | is_job | is_async_job | spec_digest                                                      | is_upgrading | managing_object_domain | managing_object_name |
|--------------+---------+---------------+-------------+-----------+-----------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------+-------------------+------------------+---------------------+---------------+---------------+-------------+------------------------------+-------------------------------+-------------------------------+------------+--------------+-------------------+---------+-----------------+-----------------+--------+--------------+------------------------------------------------------------------+--------------+------------------------+----------------------|
| ECHO_SERVICE | RUNNING | TUTORIAL_DB   | DATA_SCHEMA | TEST_ROLE | TUTORIAL_COMPUTE_POOL | ---                                                                                                                                                          | echo-service.k3m6.svc.spcs.internal |                 1 |                1 |                   1 |             1 |             1 | true        | NULL                         | 2024-11-29 12:12:47.310 -0800 | 2024-11-29 12:12:48.843 -0800 | NULL       | NULL         |                 0 | NULL    | ROLE            | NULL            | false  | false        | edaf548eb0c2744a87426529b53aac75756d0ea1c0ba5edb3cbb4295a381f2b4 | false        | NULL                   | NULL                 |
|              |         |               |             |           |                       | spec:                                                                                                                                                        |                                     |                   |                  |                     |               |               |             |                              |                               |                               |            |              |                   |         |                 |                 |        |              |                                                                  |              |                        |                      |
|              |         |               |             |           |                       |   containers:                                                                                                                                                |                                     |                   |                  |                     |               |               |             |                              |                               |                               |            |              |                   |         |                 |                 |        |              |                                                                  |              |                        |                      |
|              |         |               |             |           |                       |   - name: "echo"                                                                                                                                             |                                     |                   |                  |                     |               |               |             |                              |                               |                               |            |              |                   |         |                 |                 |        |              |                                                                  |              |                        |                      |
|              |         |               |             |           |                       |     image: "sfengineering-prod1-snowservices-test2.registry.snowflakecomputing.cn/tutorial_db/data_schema/tutorial_repository/my_echo_service_image:latest" |                                     |                   |                  |                     |               |               |             |                              |                               |                               |            |              |                   |         |                 |                 |        |              |                                                                  |              |                        |                      |
|              |         |               |             |           |                       |     sha256: "@sha256:d04a2d7b7d9bd607df994926e3cc672edcb541474e4888a01703e8bb0dd3f173"                                                                       |                                     |                   |                  |                     |               |               |             |                              |                               |                               |            |              |                   |         |                 |                 |        |              |                                                                  |              |                        |                      |
|              |         |               |             |           |                       |     env:                                                                                                                                                     |                                     |                   |                  |                     |               |               |             |                              |                               |                               |            |              |                   |         |                 |                 |        |              |                                                                  |              |                        |                      |
|              |         |               |             |           |                       |       SERVER_PORT: "8000"                                                                                                                                    |                                     |                   |                  |                     |               |               |             |                              |                               |                               |            |              |                   |         |                 |                 |        |              |                                                                  |              |                        |                      |
|              |         |               |             |           |                       |       CHARACTER_NAME: "Bob"                                                                                                                                  |                                     |                   |                  |                     |               |               |             |                              |                               |                               |            |              |                   |         |                 |                 |        |              |                                                                  |              |                        |                      |
|              |         |               |             |           |                       |     readinessProbe:                                                                                                                                          |                                     |                   |                  |                     |               |               |             |                              |                               |                               |            |              |                   |         |                 |                 |        |              |                                                                  |              |                        |                      |
|              |         |               |             |           |                       |       port: 8000                                                                                                                                             |                                     |                   |                  |                     |               |               |             |                              |                               |                               |            |              |                   |         |                 |                 |        |              |                                                                  |              |                        |                      |
|              |         |               |             |           |                       |       path: "/healthcheck"                                                                                                                                   |                                     |                   |                  |                     |               |               |             |                              |                               |                               |            |              |                   |         |                 |                 |        |              |                                                                  |              |                        |                      |
|              |         |               |             |           |                       |     resources:                                                                                                                                               |                                     |                   |                  |                     |               |               |             |                              |                               |                               |            |              |                   |         |                 |                 |        |              |                                                                  |              |                        |                      |
|              |         |               |             |           |                       |       limits:                                                                                                                                                |                                     |                   |                  |                     |               |               |             |                              |                               |                               |            |              |                   |         |                 |                 |        |              |                                                                  |              |                        |                      |
|              |         |               |             |           |                       |         memory: "6Gi"                                                                                                                                        |                                     |                   |                  |                     |               |               |             |                              |                               |                               |            |              |                   |         |                 |                 |        |              |                                                                  |              |                        |                      |
|              |         |               |             |           |                       |         cpu: "1"                                                                                                                                             |                                     |                   |                  |                     |               |               |             |                              |                               |                               |            |              |                   |         |                 |                 |        |              |                                                                  |              |                        |                      |
|              |         |               |             |           |                       |       requests:                                                                                                                                              |                                     |                   |                  |                     |               |               |             |                              |                               |                               |            |              |                   |         |                 |                 |        |              |                                                                  |              |                        |                      |
|              |         |               |             |           |                       |         memory: "0.5Gi"                                                                                                                                      |                                     |                   |                  |                     |               |               |             |                              |                               |                               |            |              |                   |         |                 |                 |        |              |                                                                  |              |                        |                      |
|              |         |               |             |           |                       |         cpu: "0.5"                                                                                                                                           |                                     |                   |                  |                     |               |               |             |                              |                               |                               |            |              |                   |         |                 |                 |        |              |                                                                  |              |                        |                      |
|              |         |               |             |           |                       |   endpoints:                                                                                                                                                 |                                     |                   |                  |                     |               |               |             |                              |                               |                               |            |              |                   |         |                 |                 |        |              |                                                                  |              |                        |                      |
|              |         |               |             |           |                       |   - name: "echoendpoint"                                                                                                                                     |                                     |                   |                  |                     |               |               |             |                              |                               |                               |            |              |                   |         |                 |                 |        |              |                                                                  |              |                        |                      |
|              |         |               |             |           |                       |     port: 8000                                                                                                                                               |                                     |                   |                  |                     |               |               |             |                              |                               |                               |            |              |                   |         |                 |                 |        |              |                                                                  |              |                        |                      |
|              |         |               |             |           |                       |     public: true                                                                                                                                             |                                     |                   |                  |                     |               |               |             |                              |                               |                               |            |              |                   |         |                 |                 |        |              |                                                                  |              |                        |                      |
|              |         |               |             |           |                       |                                                                                                                                                              |                                     |                   |                  |                     |               |               |             |                              |                               |                               |            |              |                   |         |                 |                 |        |              |                                                                  |              |                        |                      |
+--------------+---------+---------------+-------------+-----------+-----------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------+-------------------+------------------+---------------------+---------------+---------------+-------------+------------------------------+-------------------------------+-------------------------------+------------+--------------+-------------------+---------+-----------------+-----------------+--------+--------------+------------------------------------------------------------------+--------------+------------------------+----------------------+
语言: 中文