Compilation error using snowflake COPY INTO internal stage

38 views Asked by At

Trying to do a simple unload of a Snowflake table to internal staging. Creating the stage works just fine:

CREATE OR REPLACE stage dm15152_stage FILE_FORMAT = (TYPE='CSV' COMPRESSION='GZIP')
Stage area DM15152_STAGE successfully created.

But copying the table fails

COPY INTO dm15152_stage FROM DM15152
SQL compilation error: syntax error line 1 at position 29 unexpected 'DM15152'.

The table exists, I can select rows e.g. SELECT * FROM DM15152 LIMIT 10.
I must be doing something wrong, but all of the examples I can find look like this.

1

There are 1 answers

2
Wheezil On

Well, the answer seems stupidly simple, but I thought I should post it because it defies the examples I could find. It works by using a path syntax:

COPY INTO @dm15152_stage/data.gz FROM DM15152