When you need this
A load is failing or loading the wrong data. You need to see which files are in a stage, upload a corrected file, download what a job wrote, or clean up a stage that is quietly using storage. Everything below works on internal stages, where Snowflake stores the files. External stages (S3, Azure Blob, GCS) use the same LIST, REMOVE and query syntax, but PUT and GET don't work on them.
The three kinds of internal stage
| Stage | Reference | Who can use it | Good for |
|---|---|---|---|
| User stage | @~ | Only the user who owns it | One-off uploads and personal testing |
| Table stage | @%orders | Users with ownership of the table | Files that only ever load into one table |
| Named stage | @db.sch.my_stage | Any role granted READ/WRITE | Shared and production pipelines |
You can't alter, drop or grant access to user and table stages. Use named stages for anything a service account or a second team touches.
CREATE STAGE IF NOT EXISTS raw.landing.orders_stage
FILE_FORMAT = (TYPE = CSV SKIP_HEADER = 1 FIELD_OPTIONALLY_ENCLOSED_BY = '"')
DIRECTORY = (ENABLE = TRUE)
COMMENT = 'Manual and batch uploads for ORDERS';
SHOW STAGES IN SCHEMA raw.landing;
DESCRIBE STAGE raw.landing.orders_stage;
Warning
You can't change a stage's encryption type after you create it. If external tools will read files through presigned or file URLs, decide on
ENCRYPTION = (TYPE = 'SNOWFLAKE_SSE')at creation time. Check the current documentation for which file-access features need it.
Permissions
GRANT USAGE ON DATABASE raw TO ROLE loader;
GRANT USAGE ON SCHEMA raw.landing TO ROLE loader;
GRANT READ ON STAGE raw.landing.orders_stage TO ROLE loader; -- LIST, GET, COPY INTO <table>
GRANT WRITE ON STAGE raw.landing.orders_stage TO ROLE loader; -- PUT, REMOVE, COPY INTO @stage
Grant READ before WRITE. On external stages the privilege is USAGE instead.
PUT: upload local files
PUT runs from SnowSQL, the Snowflake CLI or a driver such as the Python connector. It does not run in a Snowsight worksheet. For small files, Snowsight has an upload option on the stage's page.
-- Linux / macOS
PUT file:///data/orders/2026-11-19/*.csv @raw.landing.orders_stage/2026-11-19/
PARALLEL = 8 AUTO_COMPRESS = TRUE OVERWRITE = FALSE;
-- Windows: quote the path
PUT 'file://C:\data\orders\2026-11-19\*.csv' @raw.landing.orders_stage/2026-11-19/;
-- User stage and table stage
PUT file:///tmp/fix.csv @~/scratch/;
PUT file:///tmp/fix.csv @%orders;
| Option | Default | Notes |
|---|---|---|
AUTO_COMPRESS | TRUE | gzips the file and adds .gz to the name |
SOURCE_COMPRESSION | AUTO_DETECT | Set it if the file is already compressed in a format Snowflake doesn't detect |
PARALLEL | 4 | Threads used to upload large files |
OVERWRITE | FALSE | If FALSE, a file with the same name is not replaced |
The result has a status column for each file. UPLOADED means the upload worked. SKIPPED means a file with that name already exists, so nothing was replaced.
With the Snowflake CLI:
snow stage copy ./data/orders/2026-11-19/ @raw.landing.orders_stage/2026-11-19/ --recursive
snow stage list-files raw.landing.orders_stage --pattern '.*2026-11-19.*'
snow sql -q "LIST @raw.landing.orders_stage/2026-11-19/"
Command names and flags have changed between Snowflake CLI releases. Check snow stage --help on your version.
LIST: see what is there
LIST @raw.landing.orders_stage;
LIST @raw.landing.orders_stage/2026-11-19/;
LIST @raw.landing.orders_stage PATTERN = '.*2026-11-1[0-9]/.*[.]csv[.]gz';
LS @~; -- short form
LIST @%orders;
PATTERN is a regular expression matched against the whole path, so start it with .*. Paths are case-sensitive.
Turn the output into a table you can filter and sum:
LIST @raw.landing.orders_stage;
SELECT "name", "size", "last_modified"
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()))
ORDER BY "size" DESC;
SELECT COUNT(*) AS files, SUM("size")/POWER(1024,3) AS gib
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID(-2)));
The LIST columns are lower case, so quote them.
Query staged files before loading
Check the column order, delimiters and bad rows without creating a table:
CREATE FILE FORMAT IF NOT EXISTS raw.landing.csv_fmt
TYPE = CSV SKIP_HEADER = 1 FIELD_OPTIONALLY_ENCLOSED_BY = '"';
SELECT METADATA$FILENAME, METADATA$FILE_ROW_NUMBER, t.$1, t.$2, t.$3
FROM @raw.landing.orders_stage/2026-11-19/
(FILE_FORMAT => 'raw.landing.csv_fmt', PATTERN => '.*[.]csv[.]gz') t
LIMIT 20;
-- Rows per file
SELECT METADATA$FILENAME AS file, COUNT(*) AS rows
FROM @raw.landing.orders_stage/2026-11-19/ (FILE_FORMAT => 'raw.landing.csv_fmt') t
GROUP BY 1 ORDER BY 1;
Then load. Use FILES or PATTERN so you load only what you mean to:
COPY INTO raw.landing.orders
FROM @raw.landing.orders_stage/2026-11-19/
FILE_FORMAT = (FORMAT_NAME = 'raw.landing.csv_fmt')
PATTERN = '.*[.]csv[.]gz'
ON_ERROR = ABORT_STATEMENT;
-- Table stage: no path needed
COPY INTO orders FROM @%orders FILE_FORMAT = (FORMAT_NAME = 'raw.landing.csv_fmt');
GET: download files
GET works only on internal stages and has the same client limits as PUT.
GET @raw.landing.orders_stage/2026-11-19/ file:///tmp/orders_download/
PATTERN = '.*part_00[0-9].*' PARALLEL = 10;
GET @~/scratch/fix.csv.gz 'file://C:\temp\';
Files download as they are stored, so files that PUT compressed arrive as .gz.
REMOVE: clean up
REMOVE @raw.landing.orders_stage/2026-11-01/;
REMOVE @raw.landing.orders_stage PATTERN = '.*2026-10-.*[.]csv[.]gz';
RM @%orders; -- empty the table stage
Caution
A path in
REMOVEis a prefix, not a folder.REMOVE @my_stage/ordersdeletesorders/...and alsoorders_backup.csvandorders_2025/.... Always end folder paths with/, runLISTwith the same path or pattern first, and check the count. Removed internal stage files can't be recovered with Time Travel.
To clean up as part of a load, COPY INTO ... PURGE = TRUE removes files once they have loaded.
Directory tables
A directory table is a queryable file catalog on a stage. On internal stages, refresh it after uploads unless your account has automatic refresh set up. Check what your stage type supports.
ALTER STAGE raw.landing.orders_stage REFRESH;
SELECT relative_path, size, last_modified, md5
FROM DIRECTORY(@raw.landing.orders_stage)
WHERE last_modified > DATEADD(day, -1, CURRENT_TIMESTAMP())
ORDER BY last_modified DESC;
You can join this with COPY_HISTORY to find files that were never loaded.
Common errors
| Symptom | Cause | Fix |
|---|---|---|
Stage '...' does not exist or not authorized | Wrong database/schema context, or no USAGE/READ | Use the fully qualified name. Check grants with SHOW GRANTS ON STAGE ... |
PUT fails in a Snowsight worksheet | PUT/GET need a client | Use SnowSQL, snow, a driver or the Snowsight upload option |
PUT status SKIPPED | A file with the same name already exists | Use OVERWRITE = TRUE or a new file name |
LIST ... PATTERN returns nothing | The pattern doesn't match the full path | Start the pattern with .* and check the case |
COPY loads 0 rows after re-uploading a file | Load metadata says the file was already loaded | See COPY INTO 0 rows loaded before you use FORCE = TRUE |
| Querying a staged file shows columns shifted | Wrong delimiter, enclosure or header setting | Fix the file format and query again before you COPY |
| Storage cost keeps growing | Loaded files left in table or named stages | PURGE = TRUE on loads, or scheduled REMOVE jobs |
Prevent it next time
- Use named stages with dated prefixes (
/YYYY-MM-DD/) for pipelines. Keep user and table stages for ad hoc work. - Grant
READandWRITEto pipeline roles, not toPUBLIC. - Query staged files with the file format before every new feed goes live.
- Add
PURGE = TRUEor a scheduled clean-up, and alert on total stage size fromLISTor the directory table. - Keep upload scripts on
OVERWRITE = FALSEand give corrected files new names, so the load history stays clear.
Get the weekly HubDatAI email
One email a week with everything new: posts, learning sessions and videos. Free, no spam, unsubscribe in one click. What you get