Which command is used to unload data from a Snowflake table into a file in a stage?
Which command is used to unload data from a Snowflake table into a file in a stage?
The command used to unload data from a Snowflake table into a file in a stage is 'COPY INTO'. The 'COPY INTO' command copies data from the Snowflake table into one or more files stored in a specified stage, which can be a named stage or a user stage. This stage serves as an intermediate storage location from where the files can subsequently be moved to external storage if needed. This makes option 'COPY INTO' (A) the correct answer.
As illustrated in the diagram below, unloading data to a local file system is performed in two, separate steps: Step 1 Use the COPY INTO <location> command to copy the data from the Snowflake database table into one or more files in a Snowflake stage. In the SQL statement, you specify the stage (named stage or table/user stage) where the files are written. Regardless of the stage you use, this step requires a running, current virtual warehouse for the session if you execute the command manually or within a script. The warehouse provides the compute resources to write rows from the table. Step 2 Use the GET command to download the data files to your local file system. https://docs.snowflake.com/en/user-guide/data-unload-snowflake.html
A. COPY INTO In Snowflake, the "COPY INTO" command is used to unload data from a Snowflake table into a file in a stage. The stage acts as an intermediate storage location for the unloaded data, and the data can then be transferred to an external storage location such as Amazon S3 or Microsoft Azure Blob Storage. The syntax for the "COPY INTO" command is as follows: COPY INTO [table_name] FROM [stage_name] FILE_FORMAT = [file_format]; Where [table_name] is the name of the Snowflake table from which data is being unloaded, [stage_name] is the name of the stage where the unloaded data is stored, and [file_format] is the format of the unloaded data files (such as CSV or Parquet).
Example you've given is to extract data from stage to table. Question asked to do vice versa.
A is correct
Correct