Lab: prove allowed access and reject an excluded path
Complete one provider setup, create a stage, then check both a permitted read and an excluded location. A trustworthy setup must demonstrate its boundary as well as its successful path.
Understand the idea
Choose AWS, GCS or Azure; you do not need all three. Finish that provider’s integration and cloud grants, then upload the shared orders.csv into incoming/ with the cloud provider’s approved upload tool. PUT is for internal stages, not this external upload.
| Concept | What it means |
|---|---|
| Positive check | List and read the known sample in the permitted prefix. |
| Negative check | Attempt a stage location explicitly excluded by the integration. |
| Troubleshooting | Separate identity, permissions, path, format and data errors. |
A concrete example
After provider setup and upload, expect a file entry ending in orders.csv. An empty prefix is not a successful content test.
Remember: Match the failure to its layer. Correct file access cannot compensate for incorrect parsing rules.
Explain it step by step · full theory
Understand the idea
Choose AWS, GCS or Azure; you do not need all three. Finish that provider’s integration and cloud grants, then upload the shared orders.csv into incoming/ with the cloud provider’s approved upload tool. PUT is for internal stages, not this external upload.
The main SQL uses AWS. GCS and Azure learners should use the stage already created in their provider lesson, replacing the stage name in the list and SELECT. The shared orders_csv_v1 format must exist in L2_OBJECTS_LAB.SALES. Choose an authorized warehouse for SELECT.
Follow the workflow
The sample contains four data records: Asha, Rao remains one name; Ben and Cara have unknown amounts; Dev has a known zero. LIST success proves discovery, while SELECT tests object read and parsing. A LIST that works but a SELECT that fails can indicate object-read, encryption or format problems.
The negative CREATE targets incoming/private/, which the integration explicitly blocks. It should fail. Do not remove the block to make the test pass. If it unexpectedly succeeds, inspect the actual integration, stage URL and configuration before trusting the boundary. An empty list from a forbidden path is not equivalent evidence.
For AccessDenied, inspect the active Snowflake role, container/stage grants, integration identity, cloud policies and encryption permissions. For a missing file, inspect prefix and upload destination. For shifted fields, inspect the format. Keep evidence specific: record command, expected behavior and actual error rather than reporting merely that the connection works.
Words used in this lesson
- Positive check
- List and read the known sample in the permitted prefix.
- Negative check
- Attempt a stage location explicitly excluded by the integration.
- Troubleshooting
- Separate identity, permissions, path, format and data errors.
See how it works
Choose a step to explore the idea at your own pace.
Open the interactive explanation
Lab: prove allowed access and reject an excluded path
Locate the data
Complete one provider setup, create a stage, then check both a permitted read and an excluded location. A trustworthy setup must demonstrate its boundary as well as its successful path.
Automatic playback is off for reduced motion. Select any step or use Previous and Next. Illustrations explain behavior; they are not live measurements.
Read the complete diagram explanation
- Locate the data
Complete one provider setup, create a stage, then check both a permitted read and an excluded location. A trustworthy setup must demonstrate its boundary as well as its successful path.
- Configure the boundary
Choose AWS, GCS or Azure; you do not need all three. Finish that provider’s integration and cloud grants, then upload the shared orders.csv into incoming/ with the cloud provider’s approved upload tool. PUT is for internal stages, not this external upload.
- Observe the outcome
Match the failure to its layer. Correct file access cannot compensate for incorrect parsing rules.
Try the SQL or command
Read → predict → run in your learning environment → compare. You can also learn by reading without an account.
New to SQL? Where to run it and how to read it
A query is a question written in SQL. Snowflake runs it and returns a result table. This website shows examples; it does not connect to your account.
- No account yet? Read and predict the output first. Follow the account and Snowsight lesson when you are ready.
- For SQL practice, use a learning account in Snowsight and select an authorized role and warehouse. A role determines permissions; a warehouse supplies processing power. Follow the example’s database/schema setup when it refers to stored objects.
- Read the entire example, including comments beginning with
--. Run the selected statement or labeled block in the stated order. Examples labeled Python, shell or HTTP belong in that client, not in a SQL editor. - Compare values and row counts with the explained result. If an example deliberately causes an error, follow its rollback and cleanup steps before continuing.
- SELECT / FROM
- Choose the values to return / identify their input.
- VALUES / COLUMN1
- VALUES supplies tiny example rows. COLUMN1 means their first column, COLUMN2 their second.
- AS / WITH
- AS gives a result a readable name. WITH names a temporary query step within one statement.
- NULL / ::
- NULL means missing or unknown. The :: notation converts a value to a named data type.
- Session
- One connection and its settings. Keep related transaction steps in the same session.
- Database.schema.table
- A full address for stored data. It is separate from the warehouse that processes queries.
Need the L2_OBJECTS_LAB setup? Open the first database-object lesson →
Help with common practice errors
- No active warehouse: select a warehouse your role can use. Do not assume you need to create a new one.
- Object missing or not authorized: check the full name, required setup and active role. Ask the account owner for access if needed.
- Object already exists: setup may already have run. Read the current state or choose a fresh lab name consistently; do not add OR REPLACE blindly.
- Different result: check whether an earlier INSERT or UPDATE changed the data. VALUES examples provide their own fresh input for each statement.
Shared orders.csv and internal-stage setup
Four orders, one CSV contract
Every CSV lesson uses this fictional orders.csv. One data record represents one order. The first line is a header; the four remaining lines are data. All amounts use the same fictional currency.
order_id,customer_name,amount,order_date
101,"Asha, Rao",120.50,2025-01-01
102,Ben,,2025-01-02
103,Cara,NULL,2025-01-03
104,Dev,0,2025-01-04Notice the comma inside Asha’s quoted name, Ben’s empty amount, Cara’s literal NULL marker and Dev’s zero. We will follow these exact values from file bytes to parsed fields.
Setup order for optional manual practice
- Select an authorized sandbox database and schema. Keep this context consistent across your client sessions.
- Create orders_csv_v1 using lesson 3, then orders_stage using lesson 5. Use fresh sandbox names; do not replace existing shared objects.
- Save the text above as a UTF-8 file named orders.csv. Upload it with a supported local client or the named-stage upload interface.
- Keep only this sample file under the incoming/ prefix when following the four-row expected results.
- Select an authorized warehouse for the staged SELECT examples. File previews use compute; this website runs no SQL.
The examples assume the required role privileges described in the lessons. The external-stage and JSON examples have their own additional setup and are clearly marked.
Before running this lesson
Manual learning examples, not executed here. Use L2_OBJECTS_LAB.SALES from Module 03 and an authorized warehouse for previews. Run shared format/stage setup once. Cloud examples are templates: replace every <placeholder>, use approved cloud resources, and follow the provider setup before running SQL. No credentials belong in this website.
Create the permitted AWS stage
USE DATABASE L2_OBJECTS_LAB; USE SCHEMA SALES;
CREATE STAGE m5_external_stage
URL='s3://<lab-bucket>/incoming/'
STORAGE_INTEGRATION=m5_s3_read
FILE_FORMAT=(FORMAT_NAME='orders_csv_v1');
LIST @m5_external_stage;What to expect and why
After provider setup and upload, expect a file entry ending in orders.csv. An empty prefix is not a successful content test.
Read the known sample
SELECT s.$1::NUMBER AS ORDER_ID, s.$2::VARCHAR AS CUSTOMER_NAME,
s.$3::NUMBER(10,2) AS AMOUNT,
TO_DATE(s.$4::VARCHAR,'YYYY-MM-DD') AS ORDER_DATE
FROM @m5_external_stage (FILE_FORMAT => 'orders_csv_v1') s
ORDER BY ORDER_ID;What to expect and why
With only the shared file present, expect 101/Asha, Rao/120.50; 102/Ben/NULL; 103/Cara/NULL; 104/Dev/0.00. Dates run from 2025-01-01 through 2025-01-04. No table is loaded.
Negative check — keep the blocked boundary
-- Intentionally expected to fail; run separately:
CREATE STAGE m5_should_be_denied
URL='s3://<lab-bucket>/incoming/private/'
STORAGE_INTEGRATION=m5_s3_read;What to expect and why
The blocked location should be rejected. For GCS/Azure use the same private/ suffix beneath that provider’s allowed incoming/ URL and its integration. If a stage is unexpectedly created, stop to investigate and ask its owner to remove the disposable definition.
Check your understanding
Choose an answer, then check your reasoning. This is practice, not a scored test.
Try it yourself
What evidence establishes both functionality and a boundary?
Compare your reasoning
A permitted list and four-row preview establish the sample path. A separate rejected blocked-path stage creation establishes the configured exclusion. Neither replaces broader production permission review.
Official sources and curriculum
Module 05 · See module scope