Jefferson
Jefferson

Reputation: 399

Snowflake - how to refer to internal stage for specified table with special characters in its name?

Snowflake allows table names to contain special characters, as long as the table name is surrounded by double quotes.

However, I'm having trouble referring to the internal stage for such tables. Double quotes don't seem to work when referring to these stages.

Example:

CREATE TABLE "cars (sedan)" (myint int)

Attempts to refer the internal stage for this table will fail (this was done on snowflake's online console):

LIST @%"cars (sedan)"

or

PUT file:///tmp/myfile.csv @%"cars (sedan)"

error message (for LIST):

SQL compilation error: syntax error line 1 at position 13 unexpected '('.

If the table name was something nice (like "cars"), then the query will succeed.

What is the proper way to refer to these stages?

Upvotes: 0

Views: 952

Answers (3)

JB512
JB512

Reputation: 73

Alternatively, you may also use $$ for enclosing the identifier and @%, as below:

ls $$@%"cars (sedan)"$$;

Upvotes: 1

FedSic
FedSic

Reputation: 143

Try wrapping it in single quotes:

list '@%"cars (sedan)"'

Upvotes: 2

Scott Fair
Scott Fair

Reputation: 26

According to the documentation, when copying data from files in a table stage, the FROM clause can be omitted because Snowflake automatically checks for files in the table stage.

Could you omit the FROM since the name is throwing the error?

Upvotes: -1

Related Questions