Bulk Insert
Translation reference for the Bulk Insert statement.
Some parts in the output code are omitted for clarity reasons.
The direct translation for BULK INSERT is the Snowflake COPY INTO statement. The COPY INTO
does not use directly the file path to retrieve the values. The file should exist before in a STAGE. Also the options used in the BULK INSERT
should be specified in a Snowflake FILE FORMAT that will be consumed by the STAGE
or directly by the COPY INTO
.
To add a file to some STAGE
you should use the PUT command. Notice that the command can be executed only from the SnowSQL CLI. Here is an example of the steps we should do before executing a COPY INTO
:
As you see in the code above, SnowConvert identifies all the BULK INSERTS
in the code, and for each instance, a new STAGE
and FILE FORMAT
will be created before the copy into execution. In addition, after the creation of the STAGE
, a PUT
command will be created as well in order to add the file to the stage.
The names of the generated statements are auto-generated using the current timestamp in seconds, in order to avoid collisions between their usages.
Finally, all the options for the bulk insert are being mapped to file format options if apply. If the option is not supported in Snowflake, it will be commented and a warning will be added. See also SSC-FDM-TS0004.
Supported bulk options
Related EWIs
SSC-FDM-TS0004: PUT STATEMENT IS NOT SUPPORTED ON WEB UI.
Last updated