4

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.

Vishnu Prasad
  • 73
  • 1
  • 9

2 Answers2

6

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
Iqra Ijaz
  • 261
  • 1
  • 3
6

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

blackgreen
  • 34,072
  • 23
  • 111
  • 129
jhowa1
  • 122
  • 1
  • 5