I try execute in * SnowSQL * v1.2.16
CREATE OR REPLACE PROCEDURE EDTIWKRSMWYJSYJYVFI0MQRM3K4BRQ06("start_week_id" FLOAT)
returns string
language javascript
execute as caller
as
$$
snowflake.execute({sqlText: `PUT 'file://path_to_files' @named_stage;`});
return "success";
$$;
CALL EDTIWKRSMWYJSYJYVFI0MQRM3K4BRQ06(1148);
The stored procedure works, but the data is not added to the Stage, executing the same code outside stored procedure loads data to stage. I found information in Snowflake documentation that PUT and GET command didnt work on java/scala stored procedures, but no information about javascript.
link to docs: https://docs.snowflake.com/en/sql-reference/stored-procedures-java.html
QUESTION: how i can add data to stage with javascript stored procedure
You can’t. A stored procedure runs within Snowflake which has no access to your PC. A PUT command runs on your PC and uploads a file from your PC to Snowflake.
You would need to run 2 SnowSQL commands, one to PUT the file(s) and one to run a SP (or whatever you want to build) to process he staged file - assuming that’s what you want to do