sfsql 和 SnowSQL 的区别

SnowSQL (snowsql) provides many improvements and enhancements over the sfsql command-line interface, including more intuitive option and command names. This topic lists differences in usage between the two command-line clients.

Command-line options

Many of the command-line options in SnowSQL are backward-compatible with the corresponding options in sfsql; however, there are key differences, as described in the following table:

选项

sfsql

SnowSQL (snowsql)

账户标识符

-a

-a、--accountname

用户名

-u

-u、--username

密码

-c

不适用(请使用 SNOWSQL_PWD 环境变量)

提示输入密码

不适用

-P

数据库

-d

-d、--dbname

架构

-s

-s、--schemaname

仓库

-w

-w、--warehouse

角色

-r

-r、--rolename

主机名

-g

-h、--host

端口号

-p

-p、--port

MFA 代码

-m

-m、--mfa-passcode

密码中的 MFA 代码

-n

--mfa-passcode-in-password

解释一条 SQL 语句

:code:`-e`(不支持)

不适用

解释一条 dot 形式的 SQL 语句

:code:`-x`(不支持)

不适用

运行 SQL 文件

-f

-f、--filename

出错时停止

不适用

-o stop_on_error=true

出错时退出

-k

-o exit_on_error=true

身份验证器

-b

--authenticator

使用用户定义的连接

不适用

-c、--connection

跟踪级别

-t

-o log_level=(INFO|DEBUG)

显示 CLI 版本

不适用

-v、--version

使用指定配置

不适用

--config

设置选项

不适用

-o、--option

设置变量

不适用

-D、--variable

帮助

-h

-?、--help

命令

对于命令,主要区别在于 SnowSQL 中的所有命令都必须以感叹号为前缀(例如 !exit)。此外,某些命令的名称已更改。

命令

sfsql

SnowSQL (snowsql)

加载并运行 SQL 文件

load、@

!source、!load

打印消息

echo

!print

设置选项

不适用

!set

显示所有选项

不适用

!options

设置变量

set-var

!define

取消设置变量

unset-var

不适用

显示所有变量

不适用

!variables

连接并启动新会话

connect

!connect

退出当前会话

不适用

!exit、!disconnect (另见 !quit)

将后台打印输出到文件中

spool

!spool

退出 CLI

exit、quit

!quit

执行系统命令

system

!system

帮助

help

!help

特殊字符

以下字符在两个客户端中具有特殊含义:

用途

sfsql

SnowSQL (snowsql)

变量名称前缀

$

&&

在代码中设置注释

#

-- 和 /* ... */