Vishnu Prasad
Vishnu Prasad

Reputation: 103

Adding escape sequence for space in Snowflake PUT command

I have been trying to load a file into Snowflake using PUT but I am getting an error due to space in the folder name.

PUT file://Y:/AMI Control/file.csv  @MS_FILE_LND
AUTO_COMPRESS=FALSE

I have tried using \ escape sequence and enclosing the entire path in quotes but it doesn't seem to be working.

Upvotes: 5

Views: 4258

Answers (2)

jhowa1
jhowa1

Reputation: 131

The Windows version is incorrect. The correct PUT statement is:

PUT 'file://Y:/AMI Control/file.csv' @MS_FILE_LND AUTO_COMPRESS=FALSE

Snowflake documentation says:

"The URI can be enclosed in single quotes, which allows special characters, including spaces, in directory and file names; however, the drive and path separator is a forward slash (/) for all supported operating systems (e.g. 'file://C:/temp/load data' for a path in Windows containing a directory named load data)."

https://docs.snowflake.com/en/sql-reference/sql/put.html

Upvotes: 7

Iqra Ijaz
Iqra Ijaz

Reputation: 281

This would work

For Linux/Mac:

PUT 'file:///AMI Control/file.csv'  @MS_FILE_LND AUTO_COMPRESS=FALSE

For Windows:

PUT 'file://Y:\AMI Control\file.csv'  @MS_FILE_LND AUTO_COMPRESS=FALSE

Upvotes: 7

Related Questions