snowsql python load csv file to tempstorage using put
Question:
Using Python + Snowsql
Am trying to load a CSV file using PUT command to copy the local file(s) into the Snowflake staging area for the table.
file_path = 'file://XXXXX/YYYYYY/ZZZZZZ/TEST/Final.csv'.format(os.getcwd())
con.execute("PUT '{0}' @test_results".format(file_path))
The above command is not working so may be I have to load the data to snowflake stage and use Copy to Command to load to the table.
Question : How to identify the snowflake user stage name or the stage name where the files can be loaded before copying the same to Table in snowflake
I dont have an option to view the stage in Snowflake UI
Answers:
To list the stages created in your account you can use the command:
show stages in account;
To list the stages created in the selected database and schema you can run just:
show stages;
It is also possible to use the user stage ‘@~’
This code worked
Find existing state . From CMD run Show stages
file_path = ‘file://C:/Files_to_Load/Final.csv’.format(os.getcwd())
con.execute("PUT ‘{0}’ @TEST_STAGE".format(file_path))
Using Python + Snowsql
Am trying to load a CSV file using PUT command to copy the local file(s) into the Snowflake staging area for the table.
file_path = 'file://XXXXX/YYYYYY/ZZZZZZ/TEST/Final.csv'.format(os.getcwd())
con.execute("PUT '{0}' @test_results".format(file_path))
The above command is not working so may be I have to load the data to snowflake stage and use Copy to Command to load to the table.
Question : How to identify the snowflake user stage name or the stage name where the files can be loaded before copying the same to Table in snowflake
I dont have an option to view the stage in Snowflake UI
To list the stages created in your account you can use the command:
show stages in account;
To list the stages created in the selected database and schema you can run just:
show stages;
It is also possible to use the user stage ‘@~’
This code worked
Find existing state . From CMD run Show stages
file_path = ‘file://C:/Files_to_Load/Final.csv’.format(os.getcwd())
con.execute("PUT ‘{0}’ @TEST_STAGE".format(file_path))