Differences Between SnowSQL and sfsql

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.

In this Topic:

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:

Option SnowSQL (snowsql) sfsql
Account name -a , --accountname -a
User name -u , --username -u
Password N/A (use SNOWSQL_PWD environment variable) -c
Prompt for password -P N/A
Database -d , --dbname -d
Schema -s , --schemaname -s
Warehouse -w , --warehouse -w
Role -r , --rolename -r
Host name -h , --host -g
Port number -p , --port -p
MFA passcode -m , --mfa-passcode -m
MFA passcode in password --mfa-passcode-in-password -n
Explain a SQL N/A (not supported) -e (not supported)
Explain a SQL in dot form N/A (not supported) -x (not supported)
Run a SQL file -f , --filename -f
Stop on error -o stop_on_error=true N/A
Exit on error -o exit_on_error=true -k
Authenticator --authenticator -b
Proxy Host --proxy-host -y
Proxy Port --proxy-port -z
Proxy User --proxy-user N/A
Proxy Password N/A (use SNOWSQL_PWD environment variable) N/A
Use a user-defined connection -c , --connection N/A
Trace level -o log_level=(INFO|DEBUG) -t
Show CLI version -v , --version N/A
Use specified config --config N/A
Set options -o , --option N/A
Set variables -D , --variable N/A
Help -? , --help -h

Commands

For commands, the key difference is all commands in SnowSQL must be prefixed with an exclamation point, e.g. !exit. In addition, the names of some of the commands have changed.

Command SnowSQL (snowsql) sfsql
Load and run a SQL file !source , !load load , @
Print a message !print echo
Set an option !set N/A
Show all options !options N/A
Set a variable !define set-var
Unset a variable N/A unset-var
Show all variables !variables N/A
Connect and start a new session !connect connect
Exit the current session !exit , !disconnect N/A (exiting the session, but leaving the CLI open was not supported)
Spool output into a file !spool spool
Quit the CLI !quit exit , quit
Executes a system command !system system
Help !help help

Variables

To identify variable names:

  • SnowSQL uses && as the prefix characters.
  • sfsql uses $ as the prefix character.

Comments

To set off comments from working code:

  • SnowSQL supports two types of markup, -- and /* ... */.
  • sfsql supports one type of markup, #.