Copy options ( ` copyOptions  ` )  ¶
You can specify one or more of the following copy options (separated by blank
spaces, commas, or new lines):
` OVERWRITE  =  TRUE  |  FALSE  `
Definition  :
Boolean that specifies whether the COPY command overwrites existing files with
matching names, if any, in the location where files are stored. The option
does  not  remove any existing files that do not match the names of the files
that the COPY command unloads.
In many cases, enabling this option helps prevent data duplication in the
target stage when the same COPY INTO _ <location> _ statement is executed
multiple times. However, when an unload operation writes multiple files to a
stage, Snowflake appends a suffix that ensures each file name is unique across
parallel execution threads (e.g. ` data_0_1_0  ` ). The number of parallel
execution threads can vary between unload operations. If the files written by
an unload operation do not have the same filenames as files written by a
previous operation, SQL statements that include this copy option cannot
replace the existing files, resulting in duplicate files.
In addition, in the rare event of a machine or network failure, the unload job
is retried. In that scenario, the unload operation writes additional files to
the stage without first removing any files that were previously written by the
first attempt.
To avoid data duplication in the target stage, we recommend setting the `
INCLUDE_QUERY_ID  =  TRUE  ` copy option instead of ` OVERWRITE  =  TRUE  `
and removing all data files in the target stage and path (or using a different
path for each unload operation) between each unload job.
Default  :
` FALSE  `
` SINGLE  =  TRUE  |  FALSE  `
Definition  :
Boolean that specifies whether to generate a single file or multiple files. If
` FALSE  ` , a filename prefix must be included in ` _ path  _ ` .
Important
If ` SINGLE  =  TRUE  ` , then COPY ignores the ` FILE_EXTENSION  ` file
format option and outputs a file simply named **data** . To specify a file
extension, provide a filename and extension in the internal or external
location ` _ path  _ ` . For example:
>
>     COPY INTO @mystage/data.csv ...
>  
>
> Copy
In addition, if the ` COMPRESSION  ` file format option is also explicitly set
to one of the supported compression algorithms (e.g. ` GZIP  ` ), then the
specified internal or external location ` _ path  _ ` must end in a filename
with the corresponding file extension (e.g. ` gz  ` ) so that the file can be
uncompressed using the appropriate tool. For example:
>
>     COPY INTO @mystage/data.gz ...
>  
>     COPY INTO @mystage/data.csv.gz ...
>  
>
> Copy
Default  :
` FALSE  `
` MAX_FILE_SIZE  =  _ num  _ `
Definition  :
Number (> 0) that specifies the upper size limit (in bytes) of each file to be
generated in parallel per thread. Note that the actual file size and number of
files unloaded are determined by the total amount of data and number of nodes
available for parallel processing.
Snowflake utilizes parallel execution to optimize performance. The number of
threads cannot be modified.
Maximum: 5 GB (Amazon S3 , Google Cloud Storage, or Microsoft Azure stage)
Note
The COPY command unloads one set of table rows at a time. If you set a very
small ` MAX_FILE_SIZE  ` value, the amount of data in a set of rows could
exceed the specified size.
Default  :
` 16777216  ` (16 MB)
` INCLUDE_QUERY_ID  =  TRUE  |  FALSE  `
Definition  :
Boolean that specifies whether to uniquely identify unloaded files by
including a universally unique identifier (UUID) in the filenames of unloaded
data files. This option helps ensure that concurrent COPY statements do not
overwrite unloaded files accidentally.
Values  :
If ` TRUE  ` , a UUID is added to the names of unloaded files. The UUID is the
query ID of the COPY statement used to unload the data files. The UUID is a
segment of the filename: ` <path>/data_<uuid>_<name>.<extension> ` .
If ` FALSE  ` , then a UUID is not added to the unloaded data fil