Bulk Loading, Unloading & Schema Evolution
Read a clear definition, compare the concepts, then try the SQL or client command. Detailed explanations and diagrams remain available when you need them.
Before you begin
Intermediate · 10 lessons · About 120 minutes including detailed reading.
Prerequisite: Stages, File Formats & Cloud Storage Integration. Reading needs no account. Manual SQL practice requires an authorized Snowflake account, suitable role and warehouse. Commands are examples, not executed by this website.
Complete Module 05 first. Create the separate M6_LAB schema in the first lesson and follow the supplied CSV files in order. Select that schema and an authorized warehouse in each session. The final lab checks bad rows, an export round trip and schema evolution. Nested Parquet practice is optional and requires your own valid fixture files.
Begin Module 06 →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.
What this module covers
- Bulk-loading architecture; COPY INTO <table> and COPY INTO <location>.
- Loading transformations, staged-file queries, and metadata columns such as METADATA$FILENAME.
- File selection using FILES and PATTERN; ON_ERROR, VALIDATION_MODE, and VALIDATE.
- Duplicate-file behavior, load/copy history, staged-file purging, and load failure diagnosis.
- File sizing, compression, and load parallelism.
- Schema inference: INFER_SCHEMA, GENERATE_COLUMN_DESCRIPTION, and CREATE TABLE USING TEMPLATE.
- MATCH_BY_COLUMN_NAME: case-sensitive and case-insensitive matching.
- Automatic schema evolution: ENABLE_SCHEMA_EVOLUTION, added columns, and NOT NULL relaxation.
- Nested schema inference and handling schema drift or missing/extra CSV columns.
- Lab: Load and unload files; validate bad rows and handle an evolving source schema.
Your lesson path
- Lesson 1 · About 12 min
Bulk loading: files become table rows
COPY INTO a table reads staged files with warehouse compute and stores their records as rows.
Read and practise → - Lesson 2 · About 12 min
Preview, transform and keep file lineage
Query staged fields before loading; a COPY transformation can cast, reorder or select values and capture their source.
Read and practise → - Lesson 3 · About 12 min
Choose files and diagnose bad rows
Select the intended files, validate their records, then choose what a real load should do when a row fails.
Read and practise → - Lesson 4 · About 12 min
Load history, retries and safe file cleanup
Snowflake tracks loaded files for each table. This helps retries, but it does not enforce business-key uniqueness.
Read and practise → - Lesson 5 · About 12 min
Unload rows into files and verify the export
COPY INTO a location exports a query result. Choose a separate output path, format and retry strategy.
Read and practise → - Lesson 6 · About 12 min
File size, compression and parallel loading
Loading throughput depends on file layout as well as warehouse capacity. Give workers enough useful work.
Read and practise → - Lesson 7 · About 12 min
Infer a schema and create a table from it
INFER_SCHEMA proposes column definitions from staged files. Review that proposal before creating your table.
Read and practise → - Lesson 8 · About 12 min
Match names and evolve the table deliberately
Name matching maps fields by label. Schema evolution allows supported loads to add columns and relax missing-column NOT NULL constraints.
Read and practise → - Lesson 9 · About 12 min
Nested inference and changing file contracts
Nested fields need their own schema decision: keep flexible documents or infer structured columns for compatible files.
Read and practise → - Lesson 10 · About 12 min
Lab: validate, export and evolve an order feed
Complete one small ingestion workflow and use counts, totals and schema changes as evidence.
Read and practise →