0

"'put' is not recognized as an internal or external command, operable program or batch file."

I am inputting the following: "put file://C:\FolderName\FileName.csv"

All I need to do is upload a csv from my C drive to the Snowflake cloud. I figured this would be easy, but I can't for the life of me figure out why I keep getting this message.

  • When you use the [put](https://docs.snowflake.net/manuals/sql-reference/sql/put.html) command the [internalstage](https://docs.snowflake.net/manuals/sql-reference/sql/put.html#required-parameters) parameter is required. Essentially: To what table do you want to `put` the file? – JNevill Jan 20 '20 at 17:19
  • Let's say the table is My_DatabaseName.My_SchemaName.My_tableName. How would I load the csv file into My_tableName? – Vincent_Adultman Jan 20 '20 at 17:26
  • I recommend going through this quick 20 minute guide to get a feel for SnowSQL: https://docs.snowflake.net/manuals/user-guide/getting-started-tutorial.html#snowflake-in-20-minutes – Suzy Lockwood Jan 22 '20 at 01:54

2 Answers2

0

Can you show the steps before this command is executed to show how you have logged into Snowsql? This command needs to be run inside Snowsql and the error message seems to suggest your system isn't seeing this.

@JNevill is right - the PUT commands takes the file from local (as you have identified) and places it in a Snowflake internal stage. You can create one of these stages in Snowflake or use some of the automatically provisioned ones for your user or table(s). So if you have created the table "My_tableName" you can make use of the internal stage for this with the reference "@My_tableName" so:

snowsql> put file://C:\FolderName\FileName.csv @My_tableName

Once the file is loaded into the stage then you can use the COPY INTO command to load the data into the table: https://docs.snowflake.net/manuals/sql-reference/sql/copy-into-table.html#loading-files-from-an-internal-stage

Mike Donovan
  • 369
  • 1
  • 2
0

First, you need to connect to SnowSQL from the command prompt and after that, you will be able to execute the PUT/GET command.

C:> snowsql -a snowflake_accountname -u snowflake_username

snowsql> use Database_name;

snowsql> use schema SCHEMA_NAME;

snowsql> use WAREHOUSE WAREHOUSE_NAME;

snowsql> ls @My_Stage_NAME

snowsql> put file://C:\FolderName\FileName.csv @My_Stage_NAME