Xi12
Xi12

Reputation: 1223

Alter Stage to convert it into external stage (Read from S3) Snowflake

I have created stage with json format to copy data from desktop to snowflake. Now I want to load data from s3 bucket instead of desktop.

alter stage investor_stage set url='s3://em_pi'

IF I need to create a new stage with s3 url I am able to create, but unable to alter the exsisting one

Error : SQL compilation error: Cannot set URL, credentials, or encryption key of an internal or temporary stage.

Thanks, xi

Upvotes: 0

Views: 781

Answers (1)

Mike Walton
Mike Walton

Reputation: 7369

When you created the stage the first time, you likely didn't specify any parameters that force the stage to be created as an EXTERNAL stage, which means it's an INTERNAL stage. You can not alter a stage to make that stage be EXTERNAL once its already INTERNAL. So, you can't add URL, credentials, or encryption key on an INTERNAL stage, because those never have one.

So, you need to create a new stage that has a URL, which makes it EXTERNAL.

Take a look at the documentation here on what parameters make a stage INTERNAL vs. EXTERNAL as they are very different things.

https://docs.snowflake.com/en/sql-reference/sql/create-stage.html#syntax

Upvotes: 1

Related Questions