snowflakedb/snowflake-cli

SNOW-1261806: Connection/global options are not displayed in --help until CLI verb is provided.

Closed this issue · 4 comments

SnowCLI version

2.1.1

Python version

No response

Platform

No response

What happened

snow does not provide connection, global configuration options until the user provides a deep command. For example,

snow spcs --help only provides:


 Manages Snowpark Container Services compute pools, services, image registries, and image repositories.

╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --help  -h        Show this message and exit.                                                                       │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ──────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ compute-pool                                 Manages compute pools.                                                 │
│ image-registry                               Manages image registries.                                              │
│ image-repository                             Manages image repositories.                                            │
│ service                                      Manages services.                                                      │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Not until you enter:
snow spcs compute-pool create --help do you get all of the connection and global configuration options.

Enable --help to provide global/connection configuration options at the top level (or all levels) of help.

╭─ Connection configuration ──────────────────────────────────────────────────────────────────────────────────────────╮
│ --connection,--environment  -c      TEXT  Name of the connection, as defined in your `config.toml`. Default:        │
│                                           `default`.                                                                │
│ --account,--accountname             TEXT  Name assigned to your Snowflake account. Overrides the value specified    │
│                                           for the connection.                                                       │
│ --user,--username                   TEXT  Username to connect to Snowflake. Overrides the value specified for the   │
│                                           connection.                                                               │
│ --password                          TEXT  Snowflake password. Overrides the value specified for the connection.     │
│ --authenticator                     TEXT  Snowflake authenticator. Overrides the value specified for the            │
│                                           connection.                                                               │
│ --private-key-path                  TEXT  Snowflake private key path. Overrides the value specified for the         │
│                                           connection.                                                               │
│ --database,--dbname                 TEXT  Database to use. Overrides the value specified for the connection.        │
│ --schema,--schemaname               TEXT  Database schema to use. Overrides the value specified for the connection. │
│ --role,--rolename                   TEXT  Role to use. Overrides the value specified for the connection.            │
│ --warehouse                         TEXT  Warehouse to use. Overrides the value specified for the connection.       │
│ --temporary-connection      -x            Uses connection defined with command line parameters, instead of one      │
│                                           defined in config                                                         │
│ --mfa-passcode                      TEXT  Token to use for multi-factor authentication (MFA)                        │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Global configuration ──────────────────────────────────────────────────────────────────────────────────────────────╮
│ --format           [TABLE|JSON]  Specifies the output format. [default: TABLE]                                      │
│ --verbose  -v                    Displays log entries for log levels `info` and higher.                             │
│ --debug                          Displays log entries for log levels `debug` and higher; debug logs contains        │
│                                  additional information.                                                            │
│ --silent                         Turns off intermediate output to console.                                          │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Console output

No response

How to reproduce

No response

@sfc-gh-smason What is the use case for it? CLI doesn't use these options on levels other than "command verb" level, so presenting these options in help messages for other levels would mislead our users.

The use case is to pass in connection options at the CLI. Even snow connection test --help does not provide --username --role --database etc...

snow connection test was designed to test configured connections and that's why it contains only -c / --connection option and doesn't contain other connection options which are meant to be used to create temporary connections in commands (see docs about temporary connections).

I still don't see why we should present --database, --username and other similar options in snow spcs --help, snow snowpark --help or other help messages for command groups (not final commands). These options cannot be used there, so why we should tell to user that they can use snow spcs --database while they can't?

IMO, as an user I want to know what I can do with snow spcs, so in the help message I'm getting the list of available spcs commands + the only available on this level option, which is -h / --help - I can't use other options here, so I don't see them in the help message. The same about next level command group - snow spcs service. Finally I decided to use snow spcs service create, I use --help on this level and I'm getting all the connection options because here I can use them.

Sounds good. Closing.