Study FAQ
How can Snowflake users work with staged documents without broad stage access?
Also asked as 2
- How do directory tables, scoped URLs, and FILE values support unstructured data access in Snowflake?
- How can a Snowflake role use selected staged files without being able to browse the stage?
Answer
Store documents, images, or audio on an internal or external stage. Use a directory table for file metadata and offer a filtered secure view that generates scoped URLs for approved files. The consumer can use the granted view without receiving a broad stage grant, provided the owner has the required stage access and the file is accessed through an authorized surface.
A directory table catalogs file attributes such as relative path and size on an enabled stage. It does not parse file content. A FILE value is a reference for supported functions and processing workflows. A scoped URL generated by BUILD_SCOPED_FILE_URL is an encoded, caller-scoped reference that lasts for the persisted query result period, currently 24 hours. It differs from a pre-signed link that can be used by whoever holds it.
Grant the view owner READ on a named internal stage or USAGE on a named external stage as required by the function. Grant intended consumers SELECT on the view and the relevant container access. Verify that the result only exposes permitted paths and that the chosen Snowflake function or client can use the returned reference. Apply retention and access controls to the underlying file as well as any extracted rows.
Unstructured data and FILE · Directory tables · BUILD_SCOPED_FILE_URL
Full explanation
Working with Structured, Semi-structured, and Unstructured Data
Study guide · COF-C03
Read the full explanation