How to list a stage in snowflake?

Viewed 102

Look at this procedure:

greendatasvc#COMPUTE_WH@POS_DATA.BLAZE>CREATE STAGE IF NOT EXISTS NDJSON_STAGE FILE_FORMAT = NDJSON;
+---------------------------------------------------+
| status                                            |
|---------------------------------------------------|
| NDJSON_STAGE already exists, statement succeeded. |
+---------------------------------------------------+
1 Row(s) produced. Time Elapsed: 0.182s
greendatasvc#COMPUTE_WH@POS_DATA.BLAZE>SHOW FILE FORMATS;
greendatasvc#COMPUTE_WH@POS_DATA.BLAZE>LIST @NDJSON_STAGE;
+------+------+-----+---------------+
| name | size | md5 | last_modified |
|------+------+-----+---------------|
+------+------+-----+---------------+
0 Row(s) produced. Time Elapsed: 0.192s
greendatasvc#COMPUTE_WH@POS_DATA.BLAZE>SHOW STAGES;
+-------------------------------+--------------+---------------+-------------+-----+-----------------+--------------------+----------+---------+--------+----------+-------+----------------------+---------------------+
| created_on                    | name         | database_name | schema_name | url | has_credentials | has_encryption_key | owner    | comment | region | type     | cloud | notification_channel | storage_integration |
|-------------------------------+--------------+---------------+-------------+-----+-----------------+--------------------+----------+---------+--------+----------+-------+----------------------+---------------------|
| 2021-10-19 12:31:31.043 -0700 | NDJSON_STAGE | POS_DATA      | BLAZE       |     | N               | N                  | SYSADMIN |         | NULL   | INTERNAL | NULL  | NULL                 | NULL                |
+-------------------------------+--------------+---------------+-------------+-----+-----------------+--------------------+----------+---------+--------+----------+-------+----------------------+---------------------+
1 Row(s) produced. Time Elapsed: 0.159s

I believe I already have a stage named NDJSON_STAGE based on its output when I try and create one. However, when I try and list it I get no results. Am I using the LIST function incorrectly?

2 Answers

Your stage exists, its confirmed both by the 'already exists' results response and by the fact that you did'nt receive any error when trying to list files from your stage.

If you see nothing with LIST @NDJSON_STAGE; command that's probably because you don't have any file in this stage. Upload a file in the stage using a PUT command then you should be able to list your availables stage files.

Just to be clear, LIST @stagename returns a list of files that have been staged - on that stage.

In your case the stage is empty.

If you want to display the stages for which you have access, then you can use SHOW STAGES and that lists all the stages for which you have access privileges

Related