Validate a staged file before copying or unloading
Select a stage, parsing rules and error behavior for a repeatable file transfer.
Validate a staged file before copying or unloading
Work through the decision
A supplier CSV has quoted commas in its address field. One invalid date causes the first load to fail. The supplier wants a reconciled count before finance accepts the batch. What should the operator verify?
Check your reasoning
Use a stage that addresses the agreed files and a named file format with the intended delimiter, enclosure and header behavior. Validate parsing and investigate the failing row. Choose the permitted error policy, reconcile file and row counts, then use COPY INTO the target table. For export, reverse the direction to a stage.
Compare the choices
- Named file format
- Centralize parsing or serialization options that match the actual file structure.
- Internal stage
- Store staged files in Snowflake-managed storage, using the appropriate user, table or named stage.
- External stage
- Reference files in supported external cloud storage with approved access and encryption settings.
- Directory table
- Maintain queryable file-level metadata on a supported stage, with an appropriate refresh strategy.
- COPY INTO a table
- Load staged file contents according to mappings, file format and error behavior. Inspect the returned load result.
- COPY INTO a location
- Unload query results or table data to a stage or supported external location with a chosen file format.
Test the decision
A delivery contains 500 rows. If one fails conversion and the agreed policy continues with valid rows, the acceptance record should show 499 loaded and one exception. An object in a directory table describes a staged file. That metadata alone does not establish that its contents loaded successfully.
Practice the guide skills
- Define file format options for header rows, quoting, delimiters and date parsing. Watch 1:49:53
- Choose a named, user or table internal stage for the intended file workflow. Watch 1:50:35
- Reference a permitted cloud storage path from an external stage using delegated access. Watch 1:51:53
- Identify how staged files are encrypted and who controls any required key access. Watch 1:53:24
- Inventory file paths and sizes with stage directory metadata and check the refresh mechanism. Watch 1:53:51
- Distinguish COPY INTO a target table from COPY INTO a stage using a sample command outline. Watch 1:56:52
- Compare abort, skip-file and continue behavior, then reconcile rejected records against the feed contract. Watch 1:58:28
- Unload a bounded query result to a location with a suitable file format and record its files. Watch 2:00:28
Official objectives for this lesson
Related lesson · Choose a batch ingestion and transformation path
Validate a staged file before copying or unloading quiz
Answer 3 questions. Check each answer for an explanation.