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

Understand the idea

Structured nested inference and evolution became generally available on November 18, 2026. The optional example below uses representative Parquet files, not the CSV sample. Upload valid nested Parquet files into nested/ first; an empty prefix cannot infer a schema.

Key ideas in simple English
ConceptWhat it means
Default inferenceNested values remain semi-structured.
INFER_NESTED_TYPESInfer supported nested structured types.
CSV extra/missing fieldsDistinguish changed headers from malformed records.
Type driftQuarantine or transform incompatible values deliberately.

A concrete example

An address gains a postcode. A document may retain it immediately; a structured column needs a compatible schema update.

Remember: Accepting new columns does not prove the data is correct.

Explain it step by step · full theory

How to apply it

Structured nested inference and evolution became generally available on November 18, 2026. The optional example below uses representative Parquet files, not the CSV sample. Upload valid nested Parquet files into nested/ first; an empty prefix cannot infer a schema.

For evolving structured columns, use INFER_NESTED_TYPES during inference and COPY, name matching and the same evolution prerequisites. Review inferred types before creation. CSV count mismatch tolerance is not a quality rule: check header names, required fields and malformed rows separately.

Words used in this lesson
Default inference
Nested values remain semi-structured.
INFER_NESTED_TYPES
Infer supported nested structured types.
CSV extra/missing fields
Distinguish changed headers from malformed records.
Type drift
Quarantine or transform incompatible values deliberately.

See how it works

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

Open the interactive explanation
Interactive explainer1 / 3

Nested inference and changing file contracts

Default inference
INFER_NESTED_TYPES

Understand the input

Nested fields need their own schema decision: keep flexible documents or infer structured columns for compatible files.

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

    Nested fields need their own schema decision: keep flexible documents or infer structured columns for compatible files.

  2. Follow the example

    An address gains a postcode. A document may retain it immediately; a structured column needs a compatible schema update.

  3. Check the outcome

    Accepting new columns does not prove the data is correct.

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.

Optional: inspect a nested Parquet schema

SQL · example
CREATE FILE FORMAT M6_PARQUET TYPE=PARQUET;
SELECT COLUMN_NAME, TYPE FROM TABLE(INFER_SCHEMA(
 LOCATION=>'@M6_FILES/nested/', FILE_FORMAT=>'M6_PARQUET',
 INFER_NESTED_TYPES=>TRUE));

What to expect and why

Requires your own staged nested Parquet fixtures. Results depend on their schema; inspect OBJECT/ARRAY/MAP definitions and any unsupported shapes before adopting them.

Optional: create and load structured columns

SQL · example
CREATE TABLE M6_NESTED ENABLE_SCHEMA_EVOLUTION=TRUE USING TEMPLATE (
 SELECT ARRAY_AGG(OBJECT_CONSTRUCT(*)) WITHIN GROUP (ORDER BY ORDER_ID)
 FROM TABLE(INFER_SCHEMA(LOCATION=>'@M6_FILES/nested/',
 FILE_FORMAT=>'M6_PARQUET', INFER_NESTED_TYPES=>TRUE))
);
COPY INTO M6_NESTED FROM @M6_FILES/nested/
 FILE_FORMAT=(FORMAT_NAME='M6_PARQUET')
 MATCH_BY_COLUMN_NAME=CASE_SENSITIVE INFER_NESTED_TYPES=TRUE;
DESC TABLE M6_NESTED;

What to expect and why

Column case follows the files. After uploading a new compatible file, repeat COPY to inspect schema changes; quote case-sensitive identifiers in subsequent queries.

Check your understanding

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

Does permitting extra columns validate business-required fields?

Try it yourself

A required identifier disappears from a CSV header. Should ingestion silently accept it?

Compare your reasoning

Quarantine or fail the contract check even if the loader could fill missing values with NULL.

Official sources and curriculum

Module 06 · See module scope