Unloading into Snowflake Locations

In this Topic:

Unloading Data Using Your User Staging Location

  1. Use COPY INTO location to unload all the rows in a table into one or more files in your staging location.

    For example:

    COPY INTO @~/unload/ from mytable FILE_FORMAT = (FORMAT_NAME = 'mycsv' COMPRESSION = NONE);
    

    Note that the ~ (tilde) character specifies to use your user staging location.

    In this example, the generated files are prefixed with the system default data_.

  2. Use GET to download the generated file(s) from your user location to your local machine.

    For example:

    GET @~/unload/data_0_1_0.csv file:///data/unload;
    

Unloading Data Using a Table Staging Location

  1. Use COPY INTO location to unload all the rows in a table into one or more files in the staging location for the table.

    For example:

    COPY INTO @%mytable/unload/ from mytable;
    

    Note that the % (percent) character specifies to use the staging location for the specified table.

    In this example, the generated files are prefixed with the system default data_.

  2. Use GET to download the data file(s) from the table staging location to your local machine.

    For example:

    GET @%mytable/unload/data_0_1_0.csv file:///data/unload;
    

Unloading Data Using an Internal Stage

  1. Use COPY INTO location to unload all the rows in a table into one or more files in an existing internal stage.

    For example:

    COPY INTO @my_int_stage/unload/ from mytable;
    

    Note that the @ character is immediately followed by the name of the stage.

    In this example, the generated files are prefixed with the system default data_.

  2. Use GET to download the data file(s) from the internal stage to your local machine.

    For example:

    GET @%my_int_stage/unload/data_0_1_0.csv file:///data/unload;
    

Viewing Unloaded/Staged Files

To see files that have been unloaded to an internal location (user or table staging location or an internal stage), use the LIST command:

LIST @~;

LIST @%mytable;

LIST @my_int_stage;

Note

You can also use LS as an abbreviation for the command.