Study guide

3.2 Incremental File Ingestion with Auto Loader

Databricks Certified Data Analyst Associate Exam

Track your progress as you read

Finished sections get a check mark.

1 Platform Overview & Unity Catalog Foundations

1.1 Databricks Architecture & Compute Concepts 1.2 Databricks Marketplace & Data Sharing Basics 1.3 Unity Catalog Namespace & Object Hierarchy 1.4 Governed Asset Discovery & System Tables

2 Managing & Cleaning Governed Data

2.1 Dataset Discovery & Asset Tagging 2.2 Lineage Inspection & Data Traceability 2.3 SQL Data Cleaning & Transformation Techniques

3 Data Ingestion & Import Patterns

3.1 Workspace Uploads & Cloud File Ingestion 3.2 Incremental File Ingestion with Auto Loader 3.3 Ingesting Data via Delta Sharing & External Connections

4 Databricks SQL Warehouses & Core Querying

4.1 Databricks SQL Interface & SQL Assistant 4.2 SQL Warehouses Sizing & Management 4.3 Table Creation & Data Modification in Databricks SQL

5 Advanced SQL Authoring & Time Travel

5.1 Advanced Aggregations, Window Functions & Analytics 5.2 Complex Joins, CTEs & Set Operations 5.3 Views, Materialized Views & Delta Time Travel

6 Query Performance Analysis & Photon Engine

6.1 Photon Engine Architecture & Acceleration 6.2 Query History & Execution Profile Inspection 6.3 Delta Lake Audit History & Commit Logs

7 Liquid Clustering, Caching & Performance Troubleshooting

7.1 Caching Hierarchy in Databricks SQL 7.2 Data Layout Optimization: Liquid Clustering vs Partitioning & Z-Ordering 7.3 Troubleshooting Slow & Failing Queries

8 AI/BI Dashboards & Visualization Design

8.1 AI/BI Dashboards Overview & Canvas Layout 8.2 Chart Types & Visualization Selection 8.3 Notebook & SQL Editor Visualizations

9 Dashboard Interactivity, Publishing & Alerts

9.1 Dashboard Parameters & Interactive Filtering 9.2 Publishing, Sharing & Access Control 9.3 Scheduled Refresh, Email Subscriptions & Alerts

10 Developing & Maintaining AI/BI Genie Spaces

10.1 AI/BI Genie Architecture & Space Setup 10.2 Curation via Instructions, Descriptions & Sample Questions 10.3 Trusted Assets & Parameterized Functions 10.4 Monitoring, Benchmarks, Feedback & Maintenance

11 Data Modeling & Medallion Architecture

11.1 Dimensional Modeling Fundamentals 11.2 Medallion Architecture for Analytics 11.3 Constraint Enforcement & Relationships in Unity Catalog

12 Securing Data & Unity Catalog Governance

12.1 Unity Catalog Privilege Model & Grants 12.2 Ownership, Inheritance & Access Control Patterns 12.3 Fine-Grained Security: Row Filters & Column Masks

3.2 Incremental File Ingestion with Auto Loader

Key Takeaways Explain This Topic AI

Auto Loader (cloudFiles) efficiently ingests millions of incoming files per hour incrementally from cloud storage without performing expensive directory listings.

Auto Loader maintains ingestion state using a RocksDB key-value store in a checkpoint directory, guaranteeing exactly-once processing semantics across cluster restarts.

Directory Listing mode scales up to millions of files, while File Notification mode utilizes cloud event messaging (AWS SQS, Azure Event Grid, GCP Pub/Sub) for directories with tens of millions of files.

Auto Loader automatically detects schema drift, capturing unparsed, missing, or mismatched data types in a designated _rescued_data column by default.

Schema evolution modes in Auto Loader include addNewColumns, rescue, failIfNewCol, and none, giving analysts fine-grained control over table schema drift.

Last updated: July 2026

3.2 Incremental File Ingestion with Auto Loader

As data volumes scale into millions of files arriving continuously in cloud object storage, standard batch loading patterns like file listing become a major performance bottleneck. Databricks introduced Auto Loader (configured using the cloudFiles format in Apache Spark Structured Streaming and Databricks SQL) to solve the challenges of continuous, high-scale file ingestion. Auto Loader provides an optimized, scalable, and fault-tolerant mechanism to incrementally process billions of files arriving in cloud storage landing zones.

Introduction to Auto Loader ( cloudFiles )

In traditional file ingestion engines, processing new files requires listing all objects in a directory and comparing them against previously processed file lists. Cloud storage services (such as AWS S3, Azure ADLS Gen2, and Google Cloud Storage) charge for API directory listing requests ( GET / LIST ), and performance degrades exponentially as the directory file count grows into hundreds of thousands or millions.

Auto Loader bypasses directory listing bottlenecks by automatically discovering new files as they arrive in cloud object storage. Key architectural benefits include:

Low latency : Processes incoming files within seconds of arrival.

Cost reduction : Eliminates expensive, repeated directory listing API requests.

Scalability : Seamlessly handles directories containing millions to billions of files.

Fault tolerance : Guarantees exactly-once processing semantics across pipeline restarts.

Auto Loader Architecture & Processing Modes

Auto Loader operates in two distinct file discovery modes depending on folder scale and cloud privileges:

1. Directory Listing Mode

Directory listing mode is the default discovery mode. Auto Loader identifies new files by efficiently crawling the file directory and caching file timestamps using an embedded RocksDB key-value state store saved within the checkpoint directory. Unlike standard Spark file listing, Auto Loader uses parallel lexical listing and timestamp-based filtering to discover new files quickly. Directory listing mode requires no special cloud permissions beyond read access to the storage path and supports scaling up to millions of files.

2. File Notification Mode

For directories containing tens or hundreds of millions of files, directory listing becomes inefficient. File notification mode automatically sets up and manages cloud notification services—such as AWS SNS/SQS , Azure Event Grid & Queue Storage , or GCP Pub/Sub . Cloud Object Storage Cloud Event Queue Auto Loader Engine

├── File Uploaded (S3/ADLS) ---> [Notification Queue] ---> [Reads Event & Ingests File]

When a new file lands in cloud storage, the cloud provider generates an OBJECT_CREATED event sent directly to an asynchronous queue. Auto Loader listens to the queue, fetches the target file path, and ingests the file immediately without scanning the storage directory.

Ingestion Checkpointing & Exactly-Once Semantics

Auto Loader guarantees exactly-once processing by pairing file discovery with Apache Spark Structured Streaming checkpointing.

The checkpointLocation is a required configuration option pointing to a folder in cloud storage or a Unity Catalog Volume. The checkpoint directory stores state logs, offset metadata, and RocksDB state files.

If an ingestion cluster crashes or a scheduled job is restarted, Auto Loader inspects the checkpointLocation metadata to resume ingestion precisely from the last committed offset, ensuring no files are reprocessed or skipped.

Automatic Schema Inference and Schema Evolution

Source files originating from external applications often change over time—columns are added, renamed, or assigned altered data types. Auto Loader handles schema drift automatically through schema inference and schema evolution.

Schema Inference

When Auto Loader initializes, it samples a subset of landing files to infer column names and data types automatically. Auto Loader persists this inferred schema into a designated path specified by cloudFiles.schemaLocation .

Schema Evolution Modes

Analysts control how Auto Loader responds when encountering files with new columns using the cloudFiles.schemaEvolutionMode setting:

Mode Behavior Description Typical Use Case

addNewColumns (Default) Automatically appends new columns to the target Delta table schema and merges data types. Production pipelines accommodating upstream application changes.

rescue Fixed table schema. Captures unexpected or mismatched columns into a _rescued_data column. Strict schema enforcement where table structure cannot change.

failIfNewCol Throws a runtime exception and halts ingestion if new columns are detected. Regulated environments requiring manual schema approval.

none Ignores new columns completely; only ingests columns matching the current schema. Ingesting strict subsets of landing data files.

The _rescued_data Column Pattern

By default, Auto Loader automatically appends a hidden column named _rescued_data to the target Delta table. If a source record contains an unparsed field, a missing required column, or a data type mismatch (e.g., a string value inside an integer field), Auto Loader does not drop the record or fail the stream. Instead, it serializes the problematic fields into JSON format and stores them inside _rescued_data . -- Querying rescued data to inspect ingestion anomalies

  • SELECT
  • transaction_id,
  • user_id,
  • _rescued_data
  • FROM catalog.sales.raw_transactions
  • WHERE _rescued_data IS NOT NULL;
  • Auto Loader Syntax in SQL and PySpark

Auto Loader can be configured using Databricks SQL streaming queries ( read_files ) or PySpark Structured Streaming ( cloudFiles ).

  • Streaming SQL ( read_files ) Syntax CREATE STREAMING TABLE catalog_name.iot_schema.raw_sensor_data AS
  • SELECT *
  • FROM STREAM read_files(
  • 's3://company-landing-bucket/iot_telemetry/',
  • format => 'json',
  • cloudFiles.schemaLocation => '/Volumes/catalog_name/iot_schema/checkpoints/schema/',
  • cloudFiles.schemaEvolutionMode => 'addNewColumns'
  • );
  • PySpark Structured Streaming Syntax # Auto Loader ingestion in PySpark
  • df = (spark.readStream
  • .format("cloudFiles")
  • .option("cloudFiles.format", "json")
  • .option("cloudFiles.schemaLocation", "/mnt/telemetry/_schema_path")
  • .option("cloudFiles.inferColumnTypes", "true")
  • .option("cloudFiles.schemaEvolutionMode", "addNewColumns")
  • .load("s3://company-landing-bucket/iot_telemetry/"))
  • (df.writeStream
  • .format("delta")
  • .option("checkpointLocation", "/mnt/telemetry/_checkpoint_path")
  • .outputMode("append")
  • .toTable("catalog_name.iot_schema.raw_sensor_data"))
  • Auto Loader vs. COPY INTO Selection Criteria

Data analysts must choose between COPY INTO and Auto Loader based on data scale and operational requirements:

Use COPY INTO when dataset sizes are small to moderate (thousands of files), data arrives in scheduled batch batches, and execution is managed purely through SQL scripts without streaming.

Use Auto Loader when datasets contain millions of files, files arrive continuously, schema drift requires automatic evolution or rescued data handling, or high-scale file notification queues are necessary.