Study FAQ
How do I export a Snowflake query result to a stage and retrieve the files?
Also asked as 2
- How do I use COPY INTO location to deliver a Snowflake query result?
- What are the Snowflake commands and permissions for an outbound staged export?
Answer
Run COPY INTO <location> with the destination stage and a table or SELECT query as the source. Then retrieve the output with GET from an internal stage using a supported client, or with the cloud provider's tools and credentials from an external stage. Verify the written files and reconcile them against the source result before handing them off.
COPY INTO @analytics.exports.daily_orders/run_20261125_01/
FROM (
SELECT order_id, customer_id, order_total
FROM analytics.curated.orders
WHERE order_date = DATE '2026-11-24'
)
FILE_FORMAT = (FORMAT_NAME = 'analytics.exports.parquet_export')
OVERWRITE = FALSE;
The example assumes a pre-created stage and named Parquet format, compatible columns, and a populated table. Use a fixed business date or another stable cutoff for a repeatable export. A query can filter, join, or project columns before writing. Parallel or partitioned output should be consumed as a file set. Apply a required total order explicitly in the receiving system.
Check SELECT on source objects, container and warehouse access, USAGE on the named format, and destination privileges. For a named internal stage, grant READ before or together with WRITE. The unload uses WRITE and retrieval uses READ. For a named external stage using a storage integration, check USAGE on the stage and the cloud identity's permissions for the destination path. The executing role also needs USAGE on the storage integration unless the stage-owning role has that privilege. A scoped storage integration is the preferred pattern for a private external destination.
Use COPY's result, LIST or cloud inventory, and downstream row counts or business totals to verify the delivered files.
Bulk unloading and retrieval · COPY INTO location · Stage and object privileges · LIST · Unload to a Snowflake stage
Full explanation
Unloading Data and Building Reliable Export Workflows
Study guide · COF-C03
Read the full explanation