SnowPro Associate: Platform Question 294
Single answer● Directory tablesA data engineering team stores daily CSV files in a Snowflake internal stage and wants downstream SQL processes to identify which files are currently available without listing the stage from an external tool each time. They also want file metadata such as relative path, size, and last modified time to be queryable in SQL. Which action should the team take to meet this requirement?
- A
Enable a directory table on the stage and query the directory table metadata from SQL
- B
Create a stream on the stage so file names and sizes are automatically exposed as relational rows
- C
Use the COPY INTO command with VALIDATION_MODE to populate a system table containing file metadata
- D
Create a materialized view on the stage URL so Snowflake can cache the current file listing
Show answer and explanation
Correct answer: A
Explanation
The correct solution is to enable a directory table on the stage. Directory tables are designed to let Snowflake users query staged file metadata through SQL, which is useful for orchestration, validation, and downstream processing. This is especially relevant when teams want SQL-based visibility into available files without repeatedly issuing ad hoc stage listings from external tools. In Snowflake documentation, directory tables are described as stage metadata objects that support querying file-level information such as relative path and last modified details. This aligns directly with the scenario's requirement to make current staged file metadata queryable in SQL.
- A. Correct.
Correct. Directory tables provide a catalog of files in a stage and expose file metadata that can be queried from SQL. For stages configured with a directory table, users can query metadata such as relative path, file URL, size, and last modified timestamp. This is the intended Snowflake feature for making staged file listings available to downstream SQL workloads.
- B. Incorrect.
Incorrect. Streams track row-level changes to supported objects such as tables and certain views, not file inventories within a stage. A stream cannot be created to expose stage file names and sizes as a relational file catalog. This distractor reflects a common misconception that streams can monitor all Snowflake object changes.
- C. Incorrect.
Incorrect. COPY INTO with VALIDATION_MODE is used to validate data loading behavior and identify parsing or load issues. It does not create or maintain a queryable metadata table of all files currently in a stage. Someone might pick this option because COPY operations interact with staged files, but validation is not a file cataloging feature.
- D. Incorrect.
Incorrect. Materialized views are created on supported SQL query results over base tables and certain other relational objects, not directly on a stage URL. A stage is not queried like a relational table in this way. This option is plausible because materialized views cache query results, but they are not used to inventory files in a stage.