Module 06 · Lesson 10 of 10Detailed study · 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.

Understand the idea

Complete lessons 1, 3, 5, 7 and 8 in the same lab schema. Keep M6_ORDERS unchanged and M6_ERRORS separate. Save the following changed.csv and upload it to evolve/ with the lesson 1 upload method.

Key ideas in simple English
ConceptWhat it means
Baseline2 orders; total 55.
Rejected batchOne valid row, one bad amount.
ExportRead back 2 rows and total 55.
EvolutionAdd REGION; permit missing AMOUNT.

A concrete example

The changed feed contains order 5 and REGION=west but omits AMOUNT. The raw landing table records that change.

Remember: A relaxed landing schema is useful only when downstream quality rules remain explicit.

Explain it step by step · full theory

How to apply it

Complete lessons 1, 3, 5, 7 and 8 in the same lab schema. Keep M6_ORDERS unchanged and M6_ERRORS separate. Save the following changed.csv and upload it to evolve/ with the lesson 1 upload method.

After the load, inspect the schema evolution record in DESC TABLE. Confirm REGION was added and AMOUNT is nullable. Decide whether an order without an amount belongs in reporting; this lab demonstrates landing behavior, not approval of missing prices.

Record COPY query IDs and outcomes. Keep original files for diagnosis. Optional cleanup is for this dedicated schema only, after you finish all lessons.

Words used in this lesson
Baseline
2 orders; total 55.
Rejected batch
One valid row, one bad amount.
Export
Read back 2 rows and total 55.
Evolution
Add REGION; permit missing AMOUNT.

See how it works

Choose a step to explore the idea at your own pace.

Open the interactive explanation
Interactive explainer1 / 3

Lab: validate, export and evolve an order feed

Baseline
Rejected batch

Understand the input

Complete one small ingestion workflow and use counts, totals and schema changes as evidence.

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
  1. Understand the input

    Complete one small ingestion workflow and use counts, totals and schema changes as evidence.

  2. Follow the example

    The changed feed contains order 5 and REGION=west but omits AMOUNT. The raw landing table records that change.

  3. Check the outcome

    A relaxed landing schema is useful only when downstream quality rules remain explicit.

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.

  1. No account yet? Read and predict the output first. Follow the account and Snowsight lesson when you are ready.
  2. 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.
  3. 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.
  4. 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.

Before running this lesson

Manual examples only. Start with this module’s first lesson to create L2_OBJECTS_LAB.M6_LAB. In each new SQL session select that schema and an authorized warehouse. Later lessons state additional prerequisites. Upload file contents through Snowsight or a supported client; never run CSV as SQL.

Save changed.csv; upload it to evolve/

CSV file contents · example
order_id,region
5,west

What to expect and why

The header deliberately omits AMOUNT and adds REGION.

Load the changed feed and inspect

SQL · example
COPY INTO M6_EVOLVING FROM @M6_FILES/evolve/
 FILES=('changed.csv') FILE_FORMAT=(FORMAT_NAME='M6_HEADER_CSV')
 MATCH_BY_COLUMN_NAME=CASE_INSENSITIVE;
DESC TABLE M6_EVOLVING;
SELECT ORDER_ID, AMOUNT, REGION FROM M6_EVOLVING ORDER BY ORDER_ID;

What to expect and why

For a fresh sequential lab, expect (1,20,NULL), (2,35,NULL), (5,NULL,west). AMOUNT loses NOT NULL because it is absent from the changed file; REGION is added.

Reconcile independent destinations

SQL · example
SELECT COUNT(*) AS ROW_COUNT, SUM(AMOUNT) AS TOTAL FROM M6_ORDERS;
SELECT COUNT(*) AS ACCEPTED_BAD_BATCH_ROWS FROM M6_ERRORS;
SELECT COUNT(*) AS MISSING_AMOUNTS FROM M6_EVOLVING WHERE AMOUNT IS NULL;
-- Optional, only after finishing: removes this dedicated lab and its files.
-- DROP SCHEMA L2_OBJECTS_LAB.M6_LAB CASCADE;

What to expect and why

Expect 2/55 for baseline, 1 accepted row from the bad batch, and 1 missing amount in the evolved destination. If different, inspect history and retries before changing data.

Check your understanding

Choose an answer, then check your reasoning. This is practice, not a scored test.

The evolved load succeeded with a missing amount. What comes next?

Try it yourself

Write a release checklist for this batch.

Compare your reasoning

Confirm selected files, COPY status and rejected rows; reconcile baseline count/total and export; inspect added REGION and nullable AMOUNT; quarantine missing required values; retain evidence and define retry/cleanup boundaries.

Official sources and curriculum

Module 06 · See module scope