This topic describes how to use
sfsql, including a list of the native Henplus commands that are not supported by the client.
Some Snowflake SQL commands are implemented through the JDBC driver used by
sfsql, e.g. PUT/GET for uploading files to and downloading files from internal stages.
As a result, these operations can be performed in
sfsql, but cannot be performed in the Snowflake web interface.
In this Topic:
HenPlus provides properties that control session behavior; however, you should not set these properties in
sfsql. Instead, use the session parameters provided by Snowflake.
In addition, HenPlus provides the following global properties that can be set across all sessions (the property settings are saved when you log out of the session). You can use these global properties to control the formatting and appearance of your SQL statement results:
To see the list of global parameters and their current values, type
set-propertyat the command line:
Property Initial Value Description column-delimiter | Specifies the character(s) used to separate/format columns in the display. comments-remove off (or false) Not currently used. echo-commands off (or false) Specifies whether to display a statement before executing it. sql-result-limit 1000000000 Specifies the maximum number of rows returned in the statement results. sql-result-showfooter on (or true) Specifies whether to include a footer row in the results. sql-result-showheader on (or true) Specifies whether to include a header row, including column headings, in the results.
To set a global parameter, type
set-propertyfollowed by the parameter name and value.
For example, to disable headers and footers in the results:
email@example.com> set-property sql-result-showfooter false firstname.lastname@example.org> set-property sql-result-showheader false
Note that you do not need to type any closing characters, e.g. semi-colon (
;), to set the global properties.
Executing SQL Statements and Script Files¶
To execute a SQL query or statement:
- Type a semi-colon (
;) immediately following the end of the statement.
- If you enter a new line after the statement, you must type two semi-colons (
;;) to execute the statement.
- On a new line, you can also type a forward-slash (
/) which is the command for ending a statement.
For example, any of the syntax can be used to execute the following query:
email@example.com> select * from test1; firstname.lastname@example.org> select * from test1 ;; email@example.com> select * from test1 /
To execute a SQL script file, use
@@ followed by the directory path and full name of the file (including the file extension, if any).
For example, to execute a file named
query.sql located in the
HenPlus also allows using the
start command to execute a file; however, you cannot use this command in
sfsql to execute a file because Snowflake reserves the START keyword for initiating transactions. For more information, see
Canceling In-progress Queries¶
To cancel a query that has not yet completed, use the [CTRL]-c keyboard combo.
To spool the results of a SQL query or command, type
spool followed by the directory path and name of the file in which to spool the results.
To stop spooling results, type
Accessing the Snowflake Command Line Help¶
Snowflake provides command line help topics. To access the help, use the following syntax:
info [ <topic> | <subtopic> ]
- If no value is specified, all the top-level topics in the help are displayed.
- If a topic is specified, all the subtopics for the topic are displayed.
- If a subtopic is specified, the contents of the subtopic are displayed.
info; info warehouses; info alter_warehouse;
Unsupported HenPlus Commands¶
HenPlus provides native commands for performing tasks such as describing objects and importing/exporting data from the system. You should not use these commands in
sfsql. Instead, use the SQL commands provided by Snowflake:
|Unsupported HenPlus commands:||Equivalent Snowflake SQL commands:|
||COPY INTO <table>, COPY INTO <location>|