---
title: "data load tool (dlt)"
description: "Data Load Tool (dlt) is an open-source Python library that automates extracting data from sources and loading it into destinations like DuckDB and MotherDuck, with automatic schema inference and incremental loading."
canonical: "https://motherduck.com/glossary/data-load-tool-dlt/"
related:
  - title: "dlt + MotherDuck Integration | DuckDB Analytics"
    url: "https://motherduck.com/ecosystem/dlt/"
  - title: "DuckLake Architecture Deep Dive"
    url: "https://motherduck.com/blog/ducklake-architecture-deep-dive/"
  - title: "dlt (data load tool) | MotherDuck Docs"
    url: "https://motherduck.com/docs/integrations/ingestion/dlt/"
gated_asset:
  title: "DuckLake on MotherDuck"
  url: "https://motherduck.com/product/ducklake/"
---

# data load tool (dlt)

> Data Load Tool (dlt) is an open-source Python library that automates extracting data from sources and loading it into destinations like DuckDB and MotherDuck, with automatic schema inference and incremental loading.

[Data Load Tool (dlt)](https://github.com/dlt-hub/dlt) is an open-source Python library that simplifies building data pipelines. It automates the tedious parts of [data ingestion](https://motherduck.com/learn/what-is-data-ingestion-pipeline/) — extraction, schema management, type conversion, and incremental loading — so you write pipeline logic instead of boilerplate. dlt supports a wide range of sources (REST APIs, databases, files) and destinations (data warehouses, data lakes, and local engines), presenting a consistent interface across all of them.

## What dlt does for you

- **Automatic schema inference:** dlt reads your source data, infers a schema, and creates matching tables in the destination — evolving them as the source changes.
- **Incremental loading:** load only new or changed records on each run instead of reprocessing everything, using cursor fields or merge/upsert strategies.
- **Normalization:** nested JSON is automatically unpacked into relational tables with keys linking them together.
- **Consistent EL(T):** the same code shape works whether you load into DuckDB locally or a cloud warehouse, which makes dlt a natural front end for [ELT](https://motherduck.com/glossary/elt/) workflows.

## dlt and DuckDB
dlt ships with a first-class DuckDB destination, which makes the pair a popular, zero-infrastructure way to build and test pipelines locally. A minimal pipeline that loads records into DuckDB looks like this:

```python
import dlt

pipeline = dlt.pipeline(
    pipeline_name="github_events",
    destination="duckdb",
    dataset_name="raw",
)

data = [{"id": 1, "type": "push"}, {"id": 2, "type": "pull_request"}]
load_info = pipeline.run(data, table_name="events")
print(load_info)
```

dlt creates the DuckDB database, infers the `events` table schema, and loads the rows — no manual DDL required.

### Incremental loading
On subsequent runs, incremental settings let dlt load only new records rather than reloading the whole table:

```python
@dlt.resource(primary_key="id", write_disposition="merge")
def events(updated=dlt.sources.incremental("updated_at")):
    yield from fetch_events(since=updated.last_value)
```

Here dlt tracks the `updated_at` cursor between runs and merges on `id`, so each run pulls and upserts only changed rows.

## From local DuckDB to the cloud
Because dlt abstracts the destination, a pipeline you prototype against local DuckDB can be pointed at [MotherDuck](https://motherduck.com/) by changing the destination connection string — letting you develop locally and load into a serverless cloud warehouse in production without rewriting pipeline code. Paired with a transformation tool like [dbt](https://motherduck.com/glossary/data-build-tool-dbt/), dlt covers the extract-and-load half of a modern [ELT](https://motherduck.com/glossary/elt/) stack.

<glossary-callout video="agentic-data-engineering-pipelines-ai" />