파일 형식 변경

파일 형식 변경 (ALTER FILE FORMAT)

기존 파일 형식 객체의 속성을 수정합니다. 현재 지원되는 작업은 파일 형식 이름 바꾸기, 파일 형식 옵션 변경(유형에 따라 다름), 주석 추가/변경뿐입니다. 다른 변경을 하려면 파일 형식을 삭제한 후 다시 만들어야 합니다.

참고:

CREATE FILE FORMAT , DROP FILE FORMAT , SHOW FILE FORMATS , DESCRIBE FILE FORMAT

출처: 문서

본문


구문

ALTER FILE FORMAT [ IF EXISTS ]  RENAME TO 

ALTER FILE FORMAT [ IF EXISTS ]  SET { [ formatTypeOptions ] [ COMMENT = '' ] }

여기서:

formatTypeOptions ::=
-- If TYPE = CSV
     COMPRESSION = AUTO | GZIP | BZ2 | BROTLI | ZSTD | DEFLATE | RAW_DEFLATE | NONE
     RECORD_DELIMITER = '' | NONE
     FIELD_DELIMITER = '' | NONE
     MULTI_LINE = TRUE | FALSE
     FILE_EXTENSION = ''
     PARSE_HEADER = TRUE | FALSE
     SKIP_HEADER = 
     SKIP_BLANK_LINES = TRUE | FALSE
     DATE_FORMAT = '' | AUTO
     TIME_FORMAT = '' | AUTO
     TIMESTAMP_FORMAT = '' | AUTO
     BINARY_FORMAT = HEX | BASE64 | UTF8
     ESCAPE = '' | NONE
     ESCAPE_UNENCLOSED_FIELD = '' | NONE
     TRIM_SPACE = TRUE | FALSE
     FIELD_OPTIONALLY_ENCLOSED_BY = '' | NONE
     NULL_IF = ( '' [ , '' ... ] )
     ERROR_ON_COLUMN_COUNT_MISMATCH = TRUE | FALSE
     REPLACE_INVALID_CHARACTERS = TRUE | FALSE
     EMPTY_FIELD_AS_NULL = TRUE | FALSE
     SKIP_BYTE_ORDER_MARK = TRUE | FALSE
     ENCODING = '' | UTF8
-- If TYPE = JSON
     COMPRESSION = AUTO | GZIP | BZ2 | BROTLI | ZSTD | DEFLATE | RAW_DEFLATE | NONE
     DATE_FORMAT = '' | AUTO
     TIME_FORMAT = '' | AUTO
     TIMESTAMP_FORMAT = '' | AUTO
     BINARY_FORMAT = HEX | BASE64 | UTF8
     TRIM_SPACE = TRUE | FALSE
     MULTI_LINE = TRUE | FALSE
     NULL_IF = ( '' [ , '' ... ] )
     FILE_EXTENSION = ''
     ENABLE_OCTAL = TRUE | FALSE
     ALLOW_DUPLICATE = TRUE | FALSE
     STRIP_OUTER_ARRAY = TRUE | FALSE
     STRIP_NULL_VALUES = TRUE | FALSE
     REPLACE_INVALID_CHARACTERS = TRUE | FALSE
     IGNORE_UTF8_ERRORS = TRUE | FALSE
     SKIP_BYTE_ORDER_MARK = TRUE | FALSE
-- If TYPE = AVRO
     COMPRESSION = AUTO | GZIP | BROTLI | ZSTD | DEFLATE | RAW_DEFLATE | NONE
     TRIM_SPACE = TRUE | FALSE
     REPLACE_INVALID_CHARACTERS = TRUE | FALSE
     NULL_IF = ( '' [ , '' ... ] )
-- If TYPE = ORC
     TRIM_SPACE = TRUE | FALSE
     REPLACE_INVALID_CHARACTERS = TRUE | FALSE
     NULL_IF = ( '' [ , '' ... ] )
-- If TYPE = PARQUET
     COMPRESSION = AUTO | LZO | SNAPPY | NONE
     SNAPPY_COMPRESSION = TRUE | FALSE
     BINARY_AS_TEXT = TRUE | FALSE
     USE_LOGICAL_TYPE = TRUE | FALSE
     TRIM_SPACE = TRUE | FALSE
     USE_VECTORIZED_SCANNER = TRUE | FALSE
     REPLACE_INVALID_CHARACTERS = TRUE | FALSE
     NULL_IF = ( '' [ , '' ... ] )
-- If TYPE = XML
     COMPRESSION = AUTO | GZIP | BZ2 | BROTLI | ZSTD | DEFLATE | RAW_DEFLATE | NONE
     IGNORE_UTF8_ERRORS = TRUE | FALSE
     PRESERVE_SPACE = TRUE | FALSE
     STRIP_OUTER_ELEMENT = TRUE | FALSE
     DISABLE_AUTO_CONVERT = TRUE | FALSE
     REPLACE_INVALID_CHARACTERS = TRUE | FALSE
     SKIP_BYTE_ORDER_MARK = TRUE | FALSE

매개변수

name

변경할 파일 형식의 식별자를 지정해요. 식별자에 공백이나 특수 문자가 포함된 경우 전체 문자열을 큰따옴표로 묶어야 해요. 큰따옴표로 묶인 식별자는 대소문자를 구분해요.

RENAME TO new_name

파일 형식의 새 식별자를 지정해요. 스키마 내에서 고유해야 해요.

자세한 내용은 식별자 요구 사항을 참조해요.

객체의 이름을 선택적으로 변경하면서 다른 데이터베이스 및/또는 스키마로 이동할 수 있어요. 이렇게 하려면 새 데이터베이스 및/또는 스키마 이름을 각각 db_name.schema_name.object_name 또는 schema_name.object_name 형식으로 포함하는 정규화된 new_name 값을 지정해요.

  • 대상 데이터베이스 및/또는 스키마가 이미 존재해야 해요. 또한 새 위치에 같은 이름의 객체가 이미 있으면 안 돼요. 그렇지 않으면 문이 오류를 반환해요.
  • 객체 소유자(즉, 객체에 대한 OWNERSHIP 권한이 있는 역할)가 대상 스키마도 소유하지 않는 한, 객체를 관리형 액세스 스키마로 이동하는 것은 금지돼요.

객체 이름을 변경하면 해당 객체를 참조하는 다른 객체도 새 이름으로 업데이트해야 해요.

SET ...

파일 형식에 설정할 옵션/속성을 지정해요:

FILE_FORMAT = ( ... )

파일 형식의 형식별 옵션을 수정해요. 자세한 내용은 이 항목의 형식 유형 옵션을 참조해요.

COMMENT = 'string_literal'

파일 형식에 주석을 추가하거나 기존 주석을 덮어써요.

형식 유형 옵션 (formatTypeOptions)

지정된 파일 형식 유형(TYPE = ...)에 따라 다음 형식별 옵션 중 하나 이상을 포함할 수 있어요. 옵션은 공백, 쉼표 또는 새 줄로 구분해요.

TYPE = CSV

COMPRESSION = AUTO | GZIP | BZ2 | BROTLI | ZSTD | DEFLATE | RAW_DEFLATE | NONE

사용:

데이터 로딩, 데이터 언로딩 및 외부 테이블

정의:

데이터를 로드할 때는 데이터 파일의 현재 압축 알고리즘을 지정해요. Snowflake는 이 옵션을 사용해서 이미 압축된 데이터 파일이 어떻게 압축되었는지 감지하고, 파일 안의 압축 데이터를 추출해서 로드할 수 있게 해요.

데이터를 언로드할 때는 지정된 압축 알고리즘을 사용해서 데이터 파일을 압축해요.

값:

지원되는 값 참고
AUTO 데이터를 로드할 때는 압축 알고리즘을 자동으로 감지해요. 단, 현재 Brotli로 압축된 파일은 자동으로 감지할 수 없어요. 데이터를 언로드할 때는 기본값인 gzip을 사용해서 파일을 자동으로 압축해요.
GZIP
BZ2
BROTLI Brotli로 압축된 파일을 로드하거나 언로드할 때 반드시 지정해야 해요.
ZSTD Zstandard v0.8 이상을 지원해요.
DEFLATE Deflate로 압축된 파일(zlib 헤더 포함, RFC1950)을 의미해요.
RAW_DEFLATE Raw Deflate로 압축된 파일(헤더 없음, RFC1951)을 의미해요.
NONE 데이터를 로드할 때는 파일이 압축되지 않았음을 나타내요. 데이터를 언로드할 때는 언로드된 파일을 압축하지 않도록 지정해요.

기본값:

AUTO

RECORD_DELIMITER = 'string' | NONE

용도:

데이터 로드, 데이터 언로드, 외부 테이블

정의:

입력 파일(데이터 로드) 또는 언로드된 파일(데이터 언로드)에서 레코드를 구분하는 하나 이상의 싱글바이트 또는 멀티바이트 문자예요. 일반적인 이스케이프 시퀀스나 다음 싱글바이트 또는 멀티바이트 문자를 허용해요.

싱글바이트 문자:

8진수 값(\\ 접두사) 또는 16진수 값(0x 또는 \x 접두사)을 사용할 수 있어요. 예를 들어, 캐럿 악센트(^) 문자로 레코드를 구분한다면 8진수(\\136) 또는 16진수(0x5e) 값을 지정해요.

멀티바이트 문자:

16진수 값(\x 접두사)을 사용해요. 예를 들어, 센트(¢) 문자로 레코드를 구분한다면 16진수(\xC2\xA2) 값을 지정해요.

RECORD_DELIMITER 또는 FIELD_DELIMITER의 구분 기호는 다른 파일 형식 옵션의 구분 기호의 부분 문자열이 될 수 없어요. (예: FIELD_DELIMITER = 'aa' RECORD_DELIMITER = 'aabb').

지정된 구분 기호는 유효한 UTF-8 문자여야 하며 임의의 바이트 시퀀스가 아니어야 해요. 또한 구분 기호는 최대 20자로 제한된다는 점도 참고하세요.

또한 NONE 값도 허용해요.

기본값:

데이터 로딩:

새 줄 문자예요. 여기서 '새 줄'은 논리적인 개념이라서 Windows 플랫폼의 파일에서는 \r\n도 새 줄로 인식돼요.

데이터 언로딩:

새 줄 문자(\n)예요.

FIELD_DELIMITER = 'string' | NONE

사용:

데이터 로딩, 데이터 언로딩, 외부 테이블

정의:

입력 파일(데이터 로딩) 또는 언로드된 파일(데이터 언로딩)에서 필드를 구분하는 하나 이상의 단일 바이트 또는 다중 바이트 문자예요. 일반적인 이스케이프 시퀀스나 다음 단일 바이트 또는 다중 바이트 문자를 받아들여요:

단일 바이트 문자:

8진수 값(\\ 접두사) 또는 16진수 값(0x 또는 \x 접두사)을 사용할 수 있어요. 예를 들어 캐럿(^) 문자로 레코드를 구분하는 경우 8진수(\\136) 또는 16진수(0x5e) 값을 지정하세요.

다중 바이트 문자:

16진수 값(\x 접두사)을 사용해요. 예를 들어 센트(¢) 문자로 레코드를 구분하는 경우 16진수(\xC2\xA2) 값을 지정하세요.

RECORD_DELIMITER 또는 FIELD_DELIMITER의 구분 기호는 다른 파일 형식 옵션의 구분 기호의 부분 문자열이 될 수 없어요. (예: FIELD_DELIMITER = 'aa' RECORD_DELIMITER = 'aabb').

비-ASCII 문자의 경우 결정적인 동작을 얻으려면 16진수 바이트 시퀀스 값을 사용해야 해요.

지정된 구분 기호는 유효한 UTF-8 문자여야 하며 임의의 바이트 시퀀스가 아니어야 해요. 또한 구분 기호는 최대 20자로 제한된다는 점도 참고하세요.

또한 NONE 값도 허용해요.

기본값:

쉼표(,)

MULTI_LINE = TRUE | FALSE

사용:

데이터 로딩 및 외부 테이블

정의:

여러 줄을 허용할지 여부를 지정하는 부울 값이에요. MULTI_LINEFALSE로 설정되어 있고 지정된 레코드 구분 기호가 CSV 필드 안에 존재하면 해당 필드를 포함한 레코드는 오류로 해석돼요.

기본값:

TRUE

RFC4180 사양을 따르는 대용량 비압축 CSV 파일(128MB 초과)을 로드하는 경우, MULTI_LINE이 FALSE로 설정되고 COMPRESSION이 NONE으로 설정되며 ON_ERROR가 ABORT_STATEMENT 또는 CONTINUE로 설정되면 Snowflake는 이러한 CSV 파일의 병렬 스캔을 지원해요.

FILE_EXTENSION = 'string' | NONE

사용:

데이터 언로드 전용

정의:

스테이지로 언로드되는 파일의 확장자를 지정해요. 모든 확장자를 허용해요. 원하는 소프트웨어나 서비스에서 읽을 수 있는 파일 확장자를 지정하는 것은 사용자의 책임이에요.

기본값:

null이며, 이 경우 파일 확장자는 형식 유형에 따라 결정돼요: .csv[compression]. 여기서 compressionCOMPRESSION이 설정된 경우 압축 방법에 의해 추가되는 확장자예요.

SINGLE 복사 옵션이 TRUE이면 COPY 명령은 기본적으로 파일 확장자 없이 파일을 언로드해요. 파일 확장자를 지정하려면 internal_location 또는 external_location 경로에 파일 이름과 확장자를 제공하세요 (예: copy into @stage/data.csv).

PARSE_HEADER = TRUE | FALSE

사용:

데이터 로드 전용

정의:

데이터 파일의 첫 번째 행 헤더를 사용하여 열 이름을 결정할지 여부를 지정하는 부울 값이에요.

이 파일 형식 옵션은 다음 작업에만 적용돼요:

  • INFER_SCHEMA 함수를 사용하여 열 정의를 자동으로 감지하는 작업.
  • INFER_SCHEMA 함수와 MATCH_BY_COLUMN_NAME 복사 옵션을 사용하여 CSV 데이터를 개별 열로 로드하는 작업.

옵션이 TRUE로 설정되면 첫 번째 행 헤더가 열 이름을 결정하는 데 사용돼요. 기본값 FALSE는 열 이름을 c*로 반환하며, 여기서 *는 열의 위치예요.

  • 이 옵션은 외부 테이블에서 지원되지 않아요.
  • PARSE_HEADER = TRUE로 설정하면 SKIP_HEADER 옵션은 지원되지 않아요.

기본값:

FALSE

SKIP_HEADER = integer

사용:

데이터 로드 및 외부 테이블

정의:

파일 시작 부분에서 건너뛸 줄 수예요.

SKIP_HEADER는 헤더 줄을 결정하기 위해 RECORD_DELIMITERFIELD_DELIMITER 값을 사용하지 않는다는 점에 유의하세요. 대신 파일에서 지정된 수의 CRLF(캐리지 리턴, 라인 피드)로 구분된 줄을 단순히 건너뜁니다. 그런 다음 RECORD_DELIMITERFIELD_DELIMITER를 사용하여 로드할 데이터 행을 결정합니다.

기본값:

0

SKIP_BLANK_LINES = TRUE | FALSE

사용:

데이터 로딩 및 외부 테이블

정의:

데이터 파일에서 발견되는 빈 줄을 건너뛸지 여부를 지정하는 부울 값입니다. 그렇지 않으면 빈 줄은 레코드 끝 오류를 발생시킵니다(기본 동작).

기본값:

FALSE

DATE_FORMAT = 'string' | AUTO

사용:

데이터 로딩 및 언로딩

정의:

데이터 파일(데이터 로딩) 또는 테이블(데이터 언로딩)에서 날짜 값의 형식을 정의합니다. 값이 지정되지 않았거나 AUTO인 경우 (데이터 로딩) 또는 (데이터 언로딩) 매개변수의 값이 사용됩니다.

기본값:

AUTO

TIME_FORMAT = 'string' | AUTO

사용:

데이터 로딩 및 언로딩

정의:

데이터 파일(데이터 로딩) 또는 테이블(데이터 언로딩)에서 시간 값의 형식을 정의합니다. 값이 지정되지 않았거나 AUTO인 경우 (데이터 로딩) 또는 (데이터 언로딩) 매개변수의 값이 사용됩니다.

기본값:

AUTO

TIMESTAMP_FORMAT = string' | AUTO

사용:

데이터 로딩 및 언로딩

정의:

데이터 파일(데이터 로딩) 또는 테이블(데이터 언로딩)에서 타임스탬프 값의 형식을 정의합니다. 값이 지정되지 않았거나 AUTO인 경우 (데이터 로딩) 또는 (데이터 언로딩) 매개변수의 값이 사용됩니다.

기본값:

AUTO

BINARY_FORMAT = HEX | BASE64 | UTF8

사용:

데이터 로딩 및 언로딩

정의:

바이너리 입력 또는 출력의 인코딩 형식을 정의합니다. 이 옵션은 테이블의 바이너리 열로 데이터를 로딩하거나 바이너리 열에서 데이터를 언로딩할 때 사용할 수 있습니다.

기본값:

HEX

ESCAPE = 'character' | NONE

사용:

데이터 로딩 및 언로딩

정의:

묶여 있거나 묶여 있지 않은 필드 값의 이스케이프 문자로 사용되는 싱글바이트 문자열입니다. 이스케이프 문자는 문자 시퀀스에서 뒤따르는 문자들에 대해 다른 해석을 적용합니다. ESCAPE 문자를 사용하여 데이터에서 FIELD_OPTIONALLY_ENCLOSED_BY 문자의 인스턴스를 리터럴로 해석할 수 있습니다.

일반적인 이스케이프 시퀀스, 8진수 값 또는 16진수 값을 허용합니다.

데이터 로딩:

묶여 있는 필드에 대해서만 이스케이프 문자를 지정합니다. FIELD_OPTIONALLY_ENCLOSED_BY를 설정하여 필드를 묶는 데 사용되는 문자를 지정하세요.

이 파일 형식 옵션은 싱글바이트 문자만 지원합니다. UTF-8 문자 인코딩은 상위 ASCII 문자를 멀티바이트 문자로 표현한다는 점에 유의하세요. 데이터 파일이 UTF-8 문자 집합으로 인코딩된 경우 옵션 값으로 상위 ASCII 문자를 지정할 수 없습니다.

또한 상위 ASCII 문자를 지정하는 경우, 문자가 올바르게 해석되도록 데이터 파일의 문자 인코딩으로 ENCODING = 'string' 파일 형식 옵션을 설정하는 것이 좋습니다.

데이터 언로딩:

이 옵션을 설정하면 ESCAPE_UNENCLOSED_FIELD에 설정된 이스케이프 문자를 재정의합니다.

기본값:

NONE

ESCAPE_UNENCLOSED_FIELD = 'character' | NONE

용도:

데이터 로딩, 데이터 언로딩 및 외부 테이블

정의:

묶여 있지 않은 필드 값에 대해서만 이스케이프 문자로 사용되는 싱글바이트 문자열입니다. 이스케이프 문자는 문자 시퀀스에서 뒤따르는 문자들에 대해 다른 해석을 적용합니다. ESCAPE 문자를 사용하여 데이터에서 FIELD_DELIMITER 또는 RECORD_DELIMITER 문자의 인스턴스를 리터럴로 해석할 수 있습니다. 이스케이프 문자는 데이터에서 자신의 인스턴스를 이스케이프하는 데에도 사용할 수 있습니다.

일반적인 이스케이프 시퀀스, 8진수 값 또는 16진수 값을 허용합니다.

데이터 로딩:

묶여 있지 않은 필드에 대해서만 이스케이프 문자를 지정합니다.

  • 기본값은 \\예요. 데이터 파일의 한 행이 백슬래시(\) 문자로 끝나면, 이 문자가 RECORD_DELIMITER 파일 형식 옵션에 지정된 줄바꿈 또는 캐리지 리턴 문자를 이스케이프해요. 그 결과 로드 작업은 이 행과 다음 행을 하나의 데이터 행으로 취급해요. 이 문제를 피하려면 값을 NONE으로 설정하세요.

  • 이 파일 형식 옵션은 싱글바이트 문자만 지원해요. UTF-8 문자 인코딩은 고위 ASCII 문자를 멀티바이트 문자로 표현한다는 점에 유의하세요. 데이터 파일이 UTF-8 문자 집합으로 인코딩된 경우, 옵션 값으로 고위 ASCII 문자를 지정할 수 없어요.

    또한 고위 ASCII 문자를 지정한다면, 문자가 올바르게 해석되도록 데이터 파일의 문자 인코딩으로 ENCODING = 'string' 파일 형식 옵션을 설정하는 것을 권장해요.

데이터 언로드:

ESCAPE가 설정된 경우, 해당 파일 형식 옵션에 설정된 이스케이프 문자가 이 옵션보다 우선해요.

기본값:

백슬래시 (\\)

TRIM_SPACE = TRUE | FALSE

용도:

데이터 로드 및 외부 테이블

정의:

필드에서 공백 문자를 제거할지 여부를 지정하는 Boolean 값이에요.

예를 들어, 외부 데이터베이스 소프트웨어가 필드를 따옴표로 묶지만 앞에 공백을 삽입하는 경우, Snowflake는 여는 따옴표 문자 대신 앞 공백을 필드의 시작으로 읽어요 (즉, 따옴표가 필드 데이터 문자열의 일부로 해석돼요). 데이터 로드 중 불필요한 공백을 제거하려면 이 옵션을 TRUE로 설정하세요.

또 다른 예로, 문자열을 묶는 따옴표 주위에 앞뒤 공백이 있는 경우, 이 옵션을 사용해 주변 공백을 제거하고 FIELD_OPTIONALLY_ENCLOSED_BY 옵션을 사용해 따옴표 문자를 제거할 수 있어요. 따옴표 안의 공백은 보존된다는 점에 유의하세요. 예를 들어, FIELD_DELIMITER = '|'이고 FIELD_OPTIONALLY_ENCLOSED_BY = '"'라고 가정해요:


|"Hello world"|    /* loads as */  >Hello world Hello world Hello world:

`FALSE`

`FIELD_OPTIONALLY_ENCLOSED_BY = 'character' | NONE`

Use:

Data loading, data unloading, and external tables

Definition:

Character used to enclose strings. Value can be `NONE`, single quote character (`'`), or double quote character (`"`). To use the single quote character, use the octal or hex representation (`0x27`) or the double single-quoted escape (`''`).

Data unloading only:

When a field in the source table contains this character, Snowflake escapes it using the same character for unloading. For example, if the value is the double quote character and a field contains the string `A "B" C`, Snowflake escapes the double quotes for unloading as follows:

`A ""B"" C`

Default:

`NONE`

`NULL_IF = ( 'string1' [ , 'string2' , ... ] )`

Use:

Data loading, data unloading, and external tables

Definition:

String used to convert to and from SQL NULL:

- When loading data, Snowflake replaces these values in the data load source with SQL NULL. To specify more than one string, enclose
  the list of strings in parentheses and use commas to separate each value.

  Note that Snowflake converts all instances of the value to NULL, regardless of the data type. For example, if `2` is specified as
  a value, all instances of `2` as either a string or number are converted.

  For example:

  `NULL_IF = ('\N', 'NULL', 'NUL', '')`

  Note that this option can include empty strings.

- When unloading data, Snowflake converts SQL NULL values to the first value in the list.

Default:

`\N` (that is, NULL, which assumes the `ESCAPE_UNENCLOSED_FIELD` value is `\\`)

`ERROR_ON_COLUMN_COUNT_MISMATCH = TRUE | FALSE`

Use:

Data loading only

Definition:

Boolean that specifies whether to generate a parsing error if the number of delimited columns (i.e. fields) in an input file does not match the number of columns in the corresponding table.

If set to `FALSE`, an error is not generated and the load continues. If the file is successfully loaded:

- If the input file contains records with more fields than columns in the table, the matching fields are loaded in order of occurrence in the file and the remaining fields are not loaded.
- If the input file contains records with fewer fields than columns in the table, the non-matching columns in the table are loaded with NULL values.

This option assumes all the records within the input file are the same length (i.e. a file containing records of varying length return an error regardless of the value specified for this parameter).

Default:

`TRUE`

When [transforming data during loading](/user-guide/data-load-transform) (i.e. using a query as the source for the COPY command), this option is ignored. There is no requirement for your data files to have
the same number and ordering of columns as your target table.

`REPLACE_INVALID_CHARACTERS = TRUE | FALSE`

Use:

Data loading only

Definition:

Boolean that specifies whether to replace invalid UTF-8 characters with the Unicode replacement character (`�`).

If set to `TRUE`, Snowflake replaces invalid UTF-8 characters with the Unicode replacement character.

If set to `FALSE`, the load operation produces an error when invalid UTF-8 character encoding is detected.

Default:

`FALSE`

`EMPTY_FIELD_AS_NULL = TRUE | FALSE`

Use:

Data loading, data unloading, and external tables

Definition:

- When loading data, specifies whether to insert SQL NULL for empty fields in an input file, which are represented by two successive delimiters (For example, `,,`).

  If set to `FALSE`, Snowflake attempts to cast an empty field to the corresponding column type. An empty string is inserted into columns of type STRING. For other column types, the COPY command produces an error.

- When unloading data, this option is used in combination with `FIELD_OPTIONALLY_ENCLOSED_BY`. When `FIELD_OPTIONALLY_ENCLOSED_BY = NONE`, setting `EMPTY_FIELD_AS_NULL = FALSE` specifies to unload empty strings in tables to empty string values without quotes enclosing the field values.

  If set to `TRUE`, `FIELD_OPTIONALLY_ENCLOSED_BY` must specify a character to enclose strings.

Default:

`TRUE`

`SKIP_BYTE_ORDER_MARK = TRUE | FALSE`

Use:

Data loading only

Definition:

Boolean that specifies whether to skip the BOM (byte order mark), if present in a data file. A BOM is a character code at the beginning of a data file that defines the byte order and encoding form.

If set to `FALSE`, Snowflake recognizes any BOM in data files, which could result in the BOM either causing an error or being merged into the first column in the table.

Default:

`TRUE`

`ENCODING = 'string'`

Use:

Data loading and external tables

Definition:

String (constant) that specifies the character set of the source data when loading data into a table.

  
    
    
    
    
  
  
    
      Character Set
      `ENCODING` Value
      Supported Languages
      Notes
    
  
  
    
      Big5
      `BIG5`
      Traditional Chinese
      
    
    
      EUC-JP
      `EUCJP`
      Japanese
      
    
    
      EUC-KR
      `EUCKR`
      Korean
      
    
    
      GB18030
      `GB18030`
      Chinese
      
    
    
      IBM420
      `IBM420`
      Arabic
      
    
    
      IBM424
      `IBM424`
      Hebrew
      
    
    
      IBM949
      `IBM949`
      Korean
      
    
    
      ISO-2022-CN
      `ISO2022CN`
      Simplified Chinese
      
    
    
      ISO-2022-JP
      `ISO2022JP`
      Japanese
      
    
    
      ISO-2022-KR
      `ISO2022KR`
      Korean
      
    
    
      ISO-8859-1
      `ISO88591`
      
        Danish, Dutch, English, French, German, Italian, Norwegian, Portuguese,
        Swedish
      
      
    
    
      ISO-8859-2
      `ISO88592`
      Czech, Hungarian, Polish, Romanian
      
    
    
      ISO-8859-5
      `ISO88595`
      Russian
      
    
    
      ISO-8859-6
      `ISO88596`
      Arabic
      
    
    
      ISO-8859-7
      `ISO88597`
      Greek
      
    
    
      ISO-8859-8
      `ISO88598`
      Hebrew
      
    
    
      ISO-8859-9
      `ISO88599`
      Turkish
      
    
    
      ISO-8859-15
      `ISO885915`
      
        Danish, Dutch, English, French, German, Italian, Norwegian, Portuguese,
        Swedish
      
      
        Identical to ISO-8859-1 except for 8 characters, including the Euro
        currency symbol.
      
    
    
      KOI8-R
      `KOI8R`
      Russian
      
    
    
      Shift_JIS
      `SHIFTJIS`
      Japanese
      
    
    
      UTF-8
      `UTF8`
      All languages
      
        For loading data from delimited files (CSV, TSV, etc.), UTF-8 is the
        default.   For loading data from all other supported file
        formats (JSON, Avro, etc.), as well as unloading data, UTF-8 is the only
        supported character set.
      
    
    
      UTF-16
      `UTF16`
      All languages
      
    
    
      UTF-16BE
      `UTF16BE`
      All languages
      
    
    
      UTF-16LE
      `UTF16LE`
      All languages
      
    
    
      UTF-32
      `UTF32`
      All languages
      
    
    
      UTF-32BE
      `UTF32BE`
      All languages
      
    
    
      UTF-32LE
      `UTF32LE`
      All languages
      
    
    
      windows-874
      `WINDOWS874`
      Thai
      
    
    
      windows-949
      `WINDOWS949`
      Korean
      
    
    
      windows-1250
      `WINDOWS1250`
      Czech, Hungarian, Polish, Romanian
      
    
    
      windows-1251
      `WINDOWS1251`
      Russian
      
    
    
      windows-1252
      `WINDOWS1252`
      
        Danish, Dutch, English, French, German, Italian, Norwegian, Portuguese,
        Swedish
      
      
    
    
      windows-1253
      `WINDOWS1253`
      Greek
      
    
    
      windows-1254
      `WINDOWS1254`
      Turkish
      
    
    
      windows-1255
      `WINDOWS1255`
      Hebrew
      
    
    
      windows-1256
      `WINDOWS1256`
      Arabic
      
    
  

Default:

`UTF8`

Snowflake stores all data internally in the UTF-8 character set. The data is converted into UTF-8 before it is loaded into Snowflake.

## TYPE = JSON

`COMPRESSION = AUTO | GZIP | BZ2 | BROTLI | ZSTD | DEFLATE | RAW_DEFLATE | NONE`

Use:

Data loading and external tables

Definition:

- When loading data, specifies the current compression algorithm for the data file. Snowflake uses this option to detect how an already-compressed data file was compressed so that the compressed data in the file can be extracted for loading.
- When unloading data, compresses the data file using the specified compression algorithm.

Values:

  
    
    
  
  
    
      Supported Values
      Notes
    
  
  
    
      `AUTO`
      
        When loading data, compression algorithm detected automatically, except
        for Brotli-compressed files, which cannot currently be detected
        automatically. When unloading data, files are automatically compressed
        using the default, which is gzip.
      
    
    
      `GZIP`
      
    
    
      `BZ2`
      
    
    
      `BROTLI`
      Must be specified if loading/unloading Brotli-compressed files.
    
    
      `ZSTD`
      Zstandard v0.8 (and higher) is supported.
    
    
      `DEFLATE`
      Deflate-compressed files (with zlib header, RFC1950).
    
    
      `RAW_DEFLATE`
      Raw Deflate-compressed files (without header, RFC1951).
    
    
      `NONE`
      
        When loading data, indicates that the files have not been compressed.
        When unloading data, specifies that the unloaded files are not
        compressed.
      
    
  

Default:

`AUTO`

`DATE_FORMAT = 'string' | AUTO`

Use:

Data loading only

Definition:

Defines the format of date string values in the data files. If a value is not specified or is `AUTO`, the value for the [](#label-DATE-INPUT-FORMAT) parameter is used.

This file format option is applied to the following actions only:

- Loading JSON data into separate columns using the MATCH_BY_COLUMN_NAME copy option.
- Loading JSON data into separate columns by specifying a query in the COPY statement (i.e. COPY transformation).

Default:

`AUTO`

`TIME_FORMAT = 'string' | AUTO`

Use:

Data loading only

Definition:

Defines the format of time string values in the data files. If a value is not specified or is `AUTO`, the value for the [](#label-TIME-INPUT-FORMAT) parameter is used.

This file format option is applied to the following actions only:

- Loading JSON data into separate columns using the MATCH_BY_COLUMN_NAME copy option.
- Loading JSON data into separate columns by specifying a query in the COPY statement (i.e. COPY transformation).

Default:

`AUTO`

`TIMESTAMP_FORMAT = string' | AUTO`

Use:

Data loading only

Definition:

Defines the format of timestamp string values in the data files. If a value is not specified or is `AUTO`, the value for the [](#label-TIMESTAMP-INPUT-FORMAT) parameter is used.

This file format option is applied to the following actions only:

- Loading JSON data into separate columns using the MATCH_BY_COLUMN_NAME copy option.
- Loading JSON data into separate columns by specifying a query in the COPY statement (i.e. COPY transformation).

Default:

`AUTO`

`BINARY_FORMAT = HEX | BASE64 | UTF8`

Use:

Data loading only

Definition:

Defines the encoding format for binary string values in the data files. The option can be used when loading data into binary columns in a table.

This file format option is applied to the following actions only:

- Loading JSON data into separate columns using the MATCH_BY_COLUMN_NAME copy option.
- Loading JSON data into separate columns by specifying a query in the COPY statement (i.e. COPY transformation).

Default:

`HEX`

`TRIM_SPACE = TRUE | FALSE`

Use:

Data loading only

Definition:

Boolean that specifies whether to remove leading and trailing white space from strings.

For example, if your external database software encloses fields in quotes, but inserts a leading space, Snowflake reads the leading space rather than the opening quotation character as the beginning of the
field (i.e. the quotation marks are interpreted as part of the string of field data). Set this option to `TRUE` to remove undesirable spaces during the data load.

This file format option is applied to the following actions only when loading JSON data into separate columns using the
MATCH_BY_COLUMN_NAME copy option.

Default:

`FALSE`

`MULTI_LINE = TRUE | FALSE`

Use: Data loading and external tables

Definition:

Boolean that specifies whether multiple lines are allowed. If MULTI_LINE is set to `FALSE` and a new line is present within a JSON record, the record containing the new line will be interpreted as an error.

Default:

`TRUE`

`NULL_IF = ( 'string1' [ , 'string2' , ... ] )`

Use:

Data loading only

Definition:

String used to convert to and from SQL NULL. Snowflake replaces these strings in the data load source with SQL NULL. To
specify more than one string, enclose the list of strings in parentheses and use commas to separate each value.

This file format option is applied to the following actions only when loading JSON data into separate columns using the
MATCH_BY_COLUMN_NAME copy option.

Note that Snowflake converts all instances of the value to NULL, regardless of the data type. For example, if `2` is specified as a
value, all instances of `2` as either a string or number are converted.

For example:

`NULL_IF = ('\N', 'NULL', 'NUL', '')`

Note that this option can include empty strings.

Default:

`\N` (that is, NULL)

`FILE_EXTENSION = 'string' | NONE`

Use:

Data unloading only

Definition:

Specifies the extension for files unloaded to a stage. Accepts any extension. The user is responsible for specifying a file extension that can be read by any desired software or services.

Default:

null, meaning the file extension is determined by the format type: `.json[compression]`, where `compression` is the extension added by the compression method, if `COMPRESSION` is set.

`ENABLE_OCTAL = TRUE | FALSE`

Use:

Data loading only

Definition:

Boolean that enables parsing of octal numbers.

Default:

`FALSE`

`ALLOW_DUPLICATE = TRUE | FALSE`

Use:

Data loading and external tables

Definition:

Boolean that specifies to allow duplicate object field names (only the last one will be preserved).

Default:

`FALSE`

`STRIP_OUTER_ARRAY = TRUE | FALSE`

Use:

Data loading and external tables

Definition:

Boolean that instructs the JSON parser to remove outer brackets (i.e. `[ ]`).

Default:

`FALSE`

`STRIP_NULL_VALUES = TRUE | FALSE`

Use:

Data loading and external tables

Definition:

Boolean that instructs the JSON parser to remove object fields or array elements containing `null` values. For example, when set to `TRUE`:

| Before                                   | After                       |
| ---------------------------------------- | --------------------------- |
| `[null]`                                 | `[]`                        |
| `[null,null,3]`                          | `[,,3]`                     |
| `{"a":null,"b":null,"c":123}`            | `{"c":123}`                 |
| `{"a":[1,null,2],"b":{"x":null,"y":88}}` | `{"a":[1,,2],"b":{"y":88}}` |

Default:

`FALSE`

`REPLACE_INVALID_CHARACTERS = TRUE | FALSE`

Use:

Data loading and external table

Definition:

Boolean that specifies whether to replace invalid UTF-8 characters with the Unicode replacement character (`�`). This
option performs a one-to-one character replacement.

Values:

If set to `TRUE`, Snowflake replaces invalid UTF-8 characters with the Unicode replacement character.

If set to `FALSE`, the load operation produces an error when invalid UTF-8 character encoding is detected.

Default:

`FALSE`

`IGNORE_UTF8_ERRORS = TRUE | FALSE`

Use:

Data loading and external table

Definition:

Boolean that specifies whether UTF-8 encoding errors produce error conditions. It is an alternative syntax for `REPLACE_INVALID_CHARACTERS`.

Values:

If set to `TRUE`, any invalid UTF-8 sequences are silently replaced with the Unicode character `U+FFFD` (i.e. "replacement character").

If set to `FALSE`, the load operation produces an error when invalid UTF-8 character encoding is detected.

Default:

`FALSE`

`SKIP_BYTE_ORDER_MARK = TRUE | FALSE`

Use:

Data loading only

Definition:

Boolean that specifies whether to skip the BOM (byte order mark), if present in a data file. A BOM is a character code at the beginning of a data file that defines the byte order and encoding form.

If set to `FALSE`, Snowflake recognizes any BOM in data files, which could result in the BOM either causing an error or being merged into the first column in the table.

Default:

`TRUE`

## TYPE = AVRO

`COMPRESSION = AUTO | GZIP | BROTLI | ZSTD | DEFLATE | RAW_DEFLATE | NONE`

Use:

Data loading only

Definition:

- When loading data, specifies the current compression algorithm for the data file. Snowflake uses this option to detect how an already-compressed data file was compressed so that the compressed data in the file can be extracted for loading.
- When unloading data, compresses the data file using the specified compression algorithm.

Values:

  
    
    
  
  
    
      Supported Values
      Notes
    
  
  
    
      `AUTO`
      
        When loading data, compression algorithm detected automatically, except
        for Brotli-compressed files, which cannot currently be detected
        automatically. When unloading data, files are automatically compressed
        using the default, which is gzip.
      
    
    
      `GZIP`
      
    
    
      `BROTLI`
      Must be specified if loading/unloading Brotli-compressed files.
    
    
      `ZSTD`
      Zstandard v0.8 (and higher) is supported.
    
    
      `DEFLATE`
      Deflate-compressed files (with zlib header, RFC1950).
    
    
      `RAW_DEFLATE`
      Raw Deflate-compressed files (without header, RFC1951).
    
    
      `NONE`
      
        When loading data, indicates that the files have not been compressed.
        When unloading data, specifies that the unloaded files are not
        compressed.
      
    
  

Default:

`AUTO`.

We recommend that you use the default `AUTO` option because it will determine both the file and codec compression. Specifying a compression option refers to the compression of files, not the compression of blocks (codecs).

`TRIM_SPACE = TRUE | FALSE`

Use:

Data loading only

Definition:

Boolean that specifies whether to remove leading and trailing white space from strings.

For example, if your external database software encloses fields in quotes, but inserts a leading space, Snowflake reads the leading space rather than the opening quotation character as the beginning of the
field (i.e. the quotation marks are interpreted as part of the string of field data). Set this option to `TRUE` to remove undesirable spaces during the data load.

This file format option is applied to the following actions only when loading Avro data into separate columns using the
MATCH_BY_COLUMN_NAME copy option.

Default:

`FALSE`

`REPLACE_INVALID_CHARACTERS = TRUE | FALSE`

Use:

Data loading and external table

Definition:

Boolean that specifies whether to replace invalid UTF-8 characters with the Unicode replacement character (`�`). This
option performs a one-to-one character replacement.

Values:

If set to `TRUE`, Snowflake replaces invalid UTF-8 characters with the Unicode replacement character.

If set to `FALSE`, the load operation produces an error when invalid UTF-8 character encoding is detected.

Default:

`FALSE`

`NULL_IF = ( 'string1' [ , 'string2' , ... ] )`

Use:

Data loading only

Definition:

String used to convert to and from SQL NULL. Snowflake replaces these strings in the data load source with SQL NULL. To
specify more than one string, enclose the list of strings in parentheses and use commas to separate each value.

This file format option is applied to the following actions only when loading Avro data into separate columns using the
MATCH_BY_COLUMN_NAME copy option.

Note that Snowflake converts all instances of the value to NULL, regardless of the data type. For example, if `2` is specified as a
value, all instances of `2` as either a string or number are converted.

For example:

`NULL_IF = ('\N', 'NULL', 'NUL', '')`

Note that this option can include empty strings.

Default:

`\N` (that is, NULL)

## TYPE = ORC

`TRIM_SPACE = TRUE | FALSE`

Use:

Data loading and external tables

Definition:

Boolean that specifies whether to remove leading and trailing white space from strings.

For example, if your external database software encloses fields in quotes, but inserts a leading space, Snowflake reads the leading space rather than the opening quotation character as the beginning of the
field (i.e. the quotation marks are interpreted as part of the string of field data). Set this option to `TRUE` to remove undesirable spaces during the data load.

This file format option is applied to the following actions only when loading Orc data into separate columns using the
MATCH_BY_COLUMN_NAME copy option.

Default:

`FALSE`

`REPLACE_INVALID_CHARACTERS = TRUE | FALSE`

Use:

Data loading and external table

Definition:

Boolean that specifies whether to replace invalid UTF-8 characters with the Unicode replacement character (`�`). This
option performs a one-to-one character replacement.

Values:

If set to `TRUE`, Snowflake replaces invalid UTF-8 characters with the Unicode replacement character.

If set to `FALSE`, the load operation produces an error when invalid UTF-8 character encoding is detected.

Default:

`FALSE`

`NULL_IF = ( 'string1' [ , 'string2' , ... ] )`

Use:

Data loading and external tables

Definition:

String used to convert to and from SQL NULL. Snowflake replaces these strings in the data load source with SQL NULL. To
specify more than one string, enclose the list of strings in parentheses and use commas to separate each value.

This file format option is applied to the following actions only when loading Orc data into separate columns using the
MATCH_BY_COLUMN_NAME copy option.

Note that Snowflake converts all instances of the value to NULL, regardless of the data type. For example, if `2` is specified as a
value, all instances of `2` as either a string or number are converted.

For example:

`NULL_IF = ('\N', 'NULL', 'NUL', '')`

Note that this option can include empty strings.

Default:

`\N` (that is, NULL)

## TYPE = PARQUET

`COMPRESSION = AUTO | LZO | SNAPPY | NONE`

Use:

Data unloading and external tables

Definition:

- When unloading data, specifies the compression algorith for columns in the Parquet files.

Values:

  
    
    
  
  
    
      Supported Values
      Notes
    
  
  
    
      `AUTO`
      
        When loading data, compression algorithm detected automatically.
        Supports the following compression algorithms: Brotli, gzip,
        Lempel-Ziv-Oberhumer (LZO), LZ4, Snappy, or Zstandard v0.8 (and higher).{" "}
         When unloading data, unloaded files are compressed using the
        [Snappy](https://google.github.io/snappy/) compression algorithm by
        default.
      
    
    
      `LZO`
      
        When unloading data, files are compressed using the Snappy algorithm by
        default. If unloading data to LZO-compressed files, specify this value.
      
    
    
      `SNAPPY`
      
        When unloading data, files are compressed using the Snappy algorithm by
        default. You can optionally specify this value.
      
    
    
      `NONE`
      
        When loading data, indicates that the files have not been compressed.
        When unloading data, specifies that the unloaded files are not
        compressed.
      
    
  

Default:

`AUTO`

`SNAPPY_COMPRESSION = TRUE | FALSE`

Use:

Data unloading only

  
    
    
  
  
    
      Supported Values
      Notes
    
  
  
    
      `AUTO`
      
        Unloaded files are compressed using the
        [Snappy](https://google.github.io/snappy/) compression algorithm by
        default.
      
    
    
      `SNAPPY`
      May be specified if unloading Snappy-compressed files.
    
    
      `NONE`
      
        When loading data, indicates that the files have not been compressed.
        When unloading data, specifies that the unloaded files are not
        compressed.
      
    
  

Definition:

Boolean that specifies whether unloaded file(s) are compressed using the SNAPPY algorithm.

Deprecated. Use `COMPRESSION = SNAPPY` instead.

Limitations:

Only supported for data unloading operations.

Default:

`TRUE`

`BINARY_AS_TEXT = TRUE | FALSE`

Use:

Data loading and external tables

Definition:

Boolean that specifies whether to interpret columns with no defined logical data type as UTF-8 text. When set to `FALSE`, Snowflake interprets these columns as binary data.

Default:

`TRUE`

Snowflake recommends that you set BINARY_AS_TEXT to FALSE to avoid any potential conversion issues.

`TRIM_SPACE = TRUE | FALSE`

Use:

Data loading only

Definition:

Boolean that specifies whether to remove leading and trailing white space from strings.

For example, if your external database software encloses fields in quotes, but inserts a leading space, Snowflake reads the leading space rather than the opening quotation character as the beginning of the
field (i.e. the quotation marks are interpreted as part of the string of field data). Set this option to `TRUE` to remove undesirable spaces during the data load.

This file format option is applied to the following actions only when loading Parquet data into separate columns using the
MATCH_BY_COLUMN_NAME copy option.

Default:

`FALSE`

`USE_LOGICAL_TYPE = TRUE | FALSE`

Use:

Data loading, data querying in staged files, and schema detection.

Definition:

Boolean that specifies whether to use Parquet logical types. With this file format option, Snowflake can interpret Parquet logical types during data loading. For more information, see [Parquet Logical Type Definitions](https://github.com/apache/parquet-format/blob/master/LogicalTypes.md). To enable Parquet logical types, set USE_LOGICAL_TYPE as TRUE when you create a new file format option.

Limitations:

Not supported for data unloading.

`USE_VECTORIZED_SCANNER = TRUE | FALSE`

Use:

Data loading and data querying in staged files

Definition:

Boolean that specifies whether to use a vectorized scanner for loading Parquet files.

Default:

`FALSE`. In a future BCR, the default value will be `TRUE`.

Using the vectorized scanner can significantly reduce the latency for loading Parquet files, because this scanner is well suited for the columnar format of a [Parquet](https://parquet.apache.org/docs/file-format/) file. The scanner only downloads relevant sections of the Parquet file into memory, such as the subset of selected columns.

If `USE_VECTORIZED_SCANNER` is set to `TRUE`, the vectorized scanner has the following behaviors:

- The `BINARY_AS_TEXT` option is always treated as `FALSE` and the `USE_LOGICAL_TYPE` option is always treated as `TRUE`, no matter what the actual value is being set to.
- The vectorized scanner supports Parquet map types. The output of scanning a map type is as follows:

```sql
"my_map":
  {
"k1": "v1",
"k2": "v2"
  }
  • The vectorized scanner shows NULL values in the output, as the following example demonstrates:
"person":
 {
  "name": "Adam",
  "nickname": null,
  "age": 34,
  "phone_numbers":
  [
 "1234567890",
 "0987654321",
 null,
 "6781234590"
  ]
  }
  • The vectorized scanner handles Time and Timestamp as follows:

    Parquet
    Snowflake vectorized scanner
    
    
    
    
    TimeType(isAdjustedToUtc=True/False, unit=MILLIS/MICROS/NANOS)
    TIME
    
    
    TimestampType(isAdjustedToUtc=True, unit=MILLIS/MICROS/NANOS)
    TIMESTAMP_LTZ
    
    
    TimestampType(isAdjustedToUtc=False, unit=MILLIS/MICROS/NANOS)
    TIMESTAMP_NTZ
    
    
    INT96
    TIMESTAMP_LTZ
    

If USE_VECTORIZED_SCANNER is set to FALSE, the scanner has the following behaviors:

  • This option does not support Parquet maps. The output of scanning a map type is as follows:
"my_map":
 {
  "key_value":
  [
{
       "key": "k1",
       "value": "v1"
   },
   {
       "key": "k2",
       "value": "v2"
   }
 ]
  }
  • This option does not explicitly show NULL values in the scan output, as the following example demonstrates:
"person":
 {
  "name": "Adam",
  "age": 34
  "phone_numbers":
  [
"1234567890",
"0987654321",
"6781234590"
  ]
 }
  • This option handles Time and Timestamp as follows:

    Parquet When USE_LOGICAL_TYPE = TRUE When USE_LOGICAL_TYPE = FALSE

    TimeType(isAdjustedToUtc=True/False, unit=MILLIS/MICROS) TIME

  • TIME (If ConvertedType present)

  • INTEGER (If ConvertedType not present)

    TimeType(isAdjustedToUtc=True/False, unit=NANOS) TIME INTEGER

    TimestampType(isAdjustedToUtc=True, unit=MILLIS/MICROS) TIMESTAMP_LTZ TIMESTAMP_NTZ

    TimestampType(isAdjustedToUtc=True, unit=NANOS) TIMESTAMP_LTZ INTEGER

    TimestampType(isAdjustedToUtc=False, unit=MILLIS/MICROS) TIMESTAMP_NTZ

  • TIMESTAMP_LTZ (If ConvertedType present)

  • INTEGER (If ConvertedType not present)

    TimestampType(isAdjustedToUtc=False, unit=NANOS) TIMESTAMP_NTZ INTEGER

    INT96 TIMESTAMP_NTZ TIMESTAMP_NTZ

REPLACE_INVALID_CHARACTERS = TRUE | FALSE

Use:

Data loading and external table

Definition:

Boolean that specifies whether to replace invalid UTF-8 characters with the Unicode replacement character (). This option performs a one-to-one character replacement.

Values:

If set to TRUE, Snowflake replaces invalid UTF-8 characters with the Unicode replacement character.

If set to FALSE, the load operation produces an error when invalid UTF-8 character encoding is detected.

Default:

FALSE

NULL_IF = ( 'string1' [ , 'string2' , ... ] )

Use:

Data loading only

Definition:

String used to convert to and from SQL NULL. Snowflake replaces these strings in the data load source with SQL NULL. To specify more than one string, enclose the list of strings in parentheses and use commas to separate each value.

This file format option is applied to the following actions only when loading Parquet data into separate columns using the MATCH_BY_COLUMN_NAME copy option.

Note that Snowflake converts all instances of the value to NULL, regardless of the data type. For example, if 2 is specified as a value, all instances of 2 as either a string or number are converted.

For example:

NULL_IF = ('\N', 'NULL', 'NUL', '')

Note that this option can include empty strings.

Default:

\N (that is, NULL)

TYPE = XML

COMPRESSION = AUTO | GZIP | BZ2 | BROTLI | ZSTD | DEFLATE | RAW_DEFLATE | NONE

Use:

Data loading only

Definition:

  • When loading data, specifies the current compression algorithm for the data file. Snowflake uses this option to detect how an already-compressed data file was compressed so that the compressed data in the file can be extracted for loading.
  • When unloading data, compresses the data file using the specified compression algorithm.

Values:

  Supported Values
  Notes




  `AUTO`
  
    When loading data, compression algorithm detected automatically, except
    for Brotli-compressed files, which cannot currently be detected
    automatically. When unloading data, files are automatically compressed
    using the default, which is gzip.
  


  `GZIP`
  


  `BZ2`
  


  `BROTLI`
  Must be specified if loading/unloading Brotli-compressed files.


  `ZSTD`
  Zstandard v0.8 (and higher) is supported.


  `DEFLATE`
  Deflate-compressed files (with zlib header, RFC1950).


  `RAW_DEFLATE`
  Raw Deflate-compressed files (without header, RFC1951).


  `NONE`
  
    When loading data, indicates that the files have not been compressed.
    When unloading data, specifies that the unloaded files are not
    compressed.

Default:

AUTO

IGNORE_UTF8_ERRORS = TRUE | FALSE

Use:

Data loading and external table

Definition:

Boolean that specifies whether UTF-8 encoding errors produce error conditions. It is an alternative syntax for REPLACE_INVALID_CHARACTERS.

Values:

If set to TRUE, any invalid UTF-8 sequences are silently replaced with the Unicode character U+FFFD (i.e. "replacement character").

If set to FALSE, the load operation produces an error when invalid UTF-8 character encoding is detected.

Default:

FALSE

PRESERVE_SPACE = TRUE | FALSE

Use:

Data loading only

Definition:

Boolean that specifies whether the XML parser preserves leading and trailing spaces in element content.

Default:

FALSE

STRIP_OUTER_ELEMENT = TRUE | FALSE

Use:

Data loading only

Definition:

Boolean that specifies whether the XML parser strips out the outer XML element, exposing 2nd level elements as separate documents.

Default:

FALSE

DISABLE_AUTO_CONVERT = TRUE | FALSE

Use:

Data loading only

Definition:

Boolean that specifies whether the XML parser disables automatic conversion of numeric and Boolean values from text to native representation.

Default:

FALSE

REPLACE_INVALID_CHARACTERS = TRUE | FALSE

Use:

Data loading and external table

Definition:

Boolean that specifies whether to replace invalid UTF-8 characters with the Unicode replacement character (). This option performs a one-to-one character replacement.

Values:

If set to TRUE, Snowflake replaces invalid UTF-8 characters with the Unicode replacement character.

If set to FALSE, the load operation produces an error when invalid UTF-8 character encoding is detected.

Default:

FALSE

SKIP_BYTE_ORDER_MARK = TRUE | FALSE

Use:

Data loading only

Definition:

Boolean that specifies whether to skip any BOM (byte order mark) present in an input file. A BOM is a character code at the beginning of a data file that defines the byte order and encoding form.

If set to FALSE, Snowflake recognizes any BOM in data files, which could result in the BOM either causing an error or being merged into the first column in the table.

Default:

TRUE

Usage notes

  • ALTER FILE FORMAT does not support the following actions:

    • Changing the type (CSV, JSON, etc.) for the file format.
    • Unsetting any format options (i.e. resetting the options to the defaults for the type).
    • Unsetting (i.e. removing) a comment.

    To make any of these changes, you must recreate the file format.

Examples

Rename file format my_format to my_new_format:

ALTER FILE FORMAT IF EXISTS my_format RENAME TO my_new_format;

Specify comma (,) as the field delimiter for my_format (created in the CREATE FILE FORMAT examples):

ALTER FILE FORMAT my_format SET FIELD_DELIMITER=',';

더 알아보기 (Learn more)