Collect the smallest evidence that identifies the failure
Ana reports that her dashboard failed. Save the timestamp with time zone, user, account, client and a redacted error. If there is a query ID, save it. Establish whether she reached the account, signed in or executed SQL before assuming the grants changed.
For a session that is connected, record the current user, primary and secondary roles and warehouse. Confirm the fully qualified object name, then inspect schema, database, table and warehouse grants. Check grants to the active role and its inherited roles and check what is assigned to the user. A message about an object not existing or not being authorized can also mean a wrong name, quoted identifier or role.
After correcting an approved grant, use the same intended identity and role to replay one small positive test and one negative test. A successful administrator query says little about the analyst’s path.
Separate today’s grants from what happened yesterday
SHOW GRANTS is an immediate inspection within the executing role’s visibility. GRANTS_TO_ROLES provides historical grant records, including a deletion timestamp where available. Filter it to the roles or objects you are reviewing. Login History records attempted authentications and can lag. Recent data or limited view visibility can affect what you see.
Object access evidence answers a different question from entitlement. For supported queries, ACCESS_HISTORY can help identify accessed objects and requires Enterprise Edition or higher. Use the minimum access for audit views and handle login, query and user data in approved systems. Avoid exporting tokens, sensitive SQL text or personal data in an incident report.
| Question | First evidence |
|---|---|
| Which grants are visible now? | SHOW GRANTS TO ROLE and SHOW GRANTS ON TABLE |
| Was a sign-in attempted? | Authorized LOGIN_HISTORY and client or IdP evidence |
| Was a grant removed? | GRANTS_TO_ROLES and DELETED_ON |
| Which objects were accessed? | Authorized ACCESS_HISTORY, where available |
Walk one incident from sign-in to query and repair
Use a scoped viewer and the approved Module 17 lab, or the representative timeline below. In the live lab, follow its setup through the intentionally incomplete analyst read. Use a lab warehouse and the lab’s admin and analyst connections. The sample times and outcomes are expected evidence.
| Time UTC | Evidence | Meaning |
|---|---|---|
| 09:00 | Successful sign-in | Look past the password or SSO check. |
| 09:01 | SELECT denied for M17_ANALYST | Inspect the active role and object path. |
| 09:04 | REPORTING USAGE added to REPORT_READER | Complete the missing schema step. |
| 09:05 | Same query returns 101 / 40 and 102 / 60 | The scoped test now passes. |
Run the complete access-control incident lab →
Capture the current session and last report failure
The analyst runs the context SELECT. The second query uses the current session’s recent Query History in the lab database. Capture the report query ID and role. The user can see their own queries. Do not confuse a Session Query History result limit with a whole-account export.
SELECT CURRENT_USER(), CURRENT_ROLE(), CURRENT_SECONDARY_ROLES(), CURRENT_WAREHOUSE();
SELECT query_id, role_name, execution_status, error_code, start_time
FROM TABLE(M17_ACCESS_LAB.INFORMATION_SCHEMA.QUERY_HISTORY_BY_SESSION(
END_TIME_RANGE_START => DATEADD('hour', -1, CURRENT_TIMESTAMP()),
RESULT_LIMIT => 50
))
ORDER BY start_time DESC;Verify the real path and repair exactly one grant
Use an approved role with broad enough grant visibility for these objects. SHOW GRANTS TO USER checks membership and SHOW GRANTS TO ROLE INCLUDE HIERARCHY identifies each inherited grantee. SHOW GRANTS ON SCHEMA and TABLE verify object privileges. If SELECT is listed but schema USAGE is absent, the setup intentionally left out that step.
The managed schema owner runs the final grant. Retest the original analyst read and one prohibited write. If a denial is unexpected, leave the administrator’s result out of the acceptance evidence. Follow the capstone cleanup after the tests.
SHOW GRANTS TO USER M17_ANALYST_USER;
SHOW GRANTS TO ROLE M17_ANALYST INCLUDE HIERARCHY;
SHOW GRANTS TO ROLE PUBLIC INCLUDE HIERARCHY;
SHOW GRANTS ON SCHEMA M17_ACCESS_LAB.REPORTING;
SHOW GRANTS ON TABLE M17_ACCESS_LAB.REPORTING.ORDERS;
USE ROLE SYSADMIN;
GRANT USAGE ON SCHEMA M17_ACCESS_LAB.REPORTING
TO DATABASE ROLE M17_ACCESS_LAB.REPORT_READER;
-- In the separate analyst connection:
-- USE ROLE M17_ANALYST;
-- USE SECONDARY ROLES NONE;
-- USE WAREHOUSE M17_LAB_WH;
-- SELECT order_id, amount FROM M17_ACCESS_LAB.REPORTING.ORDERS ORDER BY order_id;Choose the correct history and keep its scope in view
Use Login History for a recent sign-in attempt, Query History for the executed statement, and current SHOW commands to see entitlements. Historical grants can show when a grant was recorded or revoked. Access History on Enterprise Edition or higher documents supported data access. A denied SELECT can appear in Query History and is not evidence that the table was read.
Use an approved governance reader with access to the relevant SNOWFLAKE Account Usage views. Use narrow time ranges and a known query ID. Access History can lag and does not cover every SQL operation. Avoid exporting the raw arrays or statements outside approved audit storage.
Read the object-access evidence for the successful query
Replace the placeholder with the successful query ID from the previous step. QUERY_HISTORY gives the active role. ACCESS_HISTORY supplies the objects directly named and the base objects read where available. Expect the ORDERS table in the recorded access from the successful direct read, subject to history latency and coverage.
SELECT q.query_id, q.role_name, a.direct_objects_accessed, a.base_objects_accessed
FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY q
LEFT JOIN SNOWFLAKE.ACCOUNT_USAGE.ACCESS_HISTORY a
ON q.query_id = a.query_id
AND a.query_start_time >= DATEADD('day', -1, CURRENT_TIMESTAMP())
WHERE q.query_id = '<successful_query_id>'
AND q.start_time >= DATEADD('day', -1, CURRENT_TIMESTAMP());Explain the design in an interview
Name the rule, then explain how you would prove it.
The login event succeeded but the app failed. What is next?
I would find the query ID and actual role. Then I would compare the namespace, warehouse and grants for that same statement. The login result tells me where to start looking.
Why might current grants and grant history disagree?
I would check the view’s lag, time filter and my visibility. I use SHOW for immediate grant state and keep the historical record for the incident timeline.
How do you distinguish access from entitlement?
A grant shows what a role can do. A supported Access History record tells me what a recorded query accessed. I use the query ID to join the evidence.
Words used in this lesson
- Entitlement
- A permission an identity can obtain through grants and role activation.
- LOGIN_HISTORY
- Historical authentication attempts for authorized reviewers.
- GRANTS_TO_ROLES
- Account Usage records for grants to roles and other supported recipients.
See how it works
Choose a step to explore the idea at your own pace.
Open the interactive explanation
Troubleshoot Snowflake Access: SHOW GRANTS, Login and Query History
Save the evidence
Begin with the identity, timestamp, operation and session context.
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
- Save the evidence
Begin with the identity, timestamp, operation and session context.
Timestamp and client → User and active roles → Exact error or query ID
- Check entitlement and activity separately
SHOW describes grants visible now. Historical views answer what happened within their scope.
Current grants → Recorded grant changes → Recorded authentication
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.
Trace both sides of the report grant
SHOW GRANTS TO ROLE M17_ANALYST;
SHOW GRANTS TO DATABASE ROLE M17_ACCESS_LAB.REPORT_READER;
SHOW GRANTS ON TABLE M17_ACCESS_LAB.REPORTING.ORDERS;What to expect and why
In the capstone, the analyst role should show the reader role and warehouse usage. The reader role should show table SELECT and currently assigned schema permissions. The database role relationship also supplies database USAGE to M17_ANALYST. The table shows its owner and grantees. Check the actual executing role’s visibility before treating a missing row as evidence of absence.
Read recent sign-in outcomes for the analyst test identity
SELECT event_timestamp, user_name, is_success,
first_authentication_factor, error_code
FROM snowflake.account_usage.login_history
WHERE user_name = 'M17_ANALYST_USER'
AND event_timestamp >= DATEADD(day, -1, CURRENT_TIMESTAMP())
ORDER BY event_timestamp DESC
LIMIT 20;What to expect and why
Use a delegated audit role with approved access. Replace the name only with the affected lab identity. The view can lag up to two hours. A matching successful entry confirms that recorded authentication event. It does not prove that the resulting role could read the report.
Compare current and revoked report-reader grant records
SELECT created_on, deleted_on, privilege, granted_on, name
FROM snowflake.account_usage.grants_to_roles
WHERE grantee_name = 'M17_ACCESS_LAB.REPORT_READER'
AND name = 'M17_ACCESS_LAB.REPORTING.ORDERS'
AND created_on >= DATEADD(day, -7, CURRENT_TIMESTAMP())
ORDER BY created_on DESC;What to expect and why
For a recently created grant, NULL DELETED_ON indicates a record without a recorded revocation. An old grant can fall outside this seven-day sample. Account Usage can lag and its view scope is limited. Pair this history with an immediate SHOW check for the live test.
Check your understanding
Choose an answer, then check your reasoning. This is practice, not a scored test.
Try it yourself
The analyst passed a read test before revocation and still can read after it. Record three paths you would audit.
Compare your reasoning
Look for another active or inherited role, an applicable PUBLIC grant or direct user privilege, and access through a different object such as a reporting view. Verify the exact object used by the test.
Official sources and curriculum
Module 17 · See module scope
By Rohit Ray · Independent educational lesson · Explore this visual lab