dlt

dlt: An open-source Python library for building data pipelines. Using simple Python decorators, it loads data from arbitrary APIs, files, or databases into data warehouses and data lakes, supporting automatic schema inference, incremental loading, and built-in data contracts. Known as the "requests" library for data pipelines.

Last repository push
GitHub Stars
219
Forks
38
Issues / PRs
7

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "dlt" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-2852151c8cc8733b2710c62f867e83d63fc62b91ceb70a8f86c5a8cb532ba66a. Verify the upstream source and version against https://github.com/TerminalSkills/skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

dlt: An open-source Python library for building data pipelines. Using simple Python decorators, it loads data from arbitrary APIs, files, or databases into data warehouses and data lakes, supporting automatic schema inference, incremental loading, and built-in data contracts. Known as the "requests" library for data pipelines.

0 Downloads

Introduction source: third_party · TerminalSkills · 1.0.0 Reference

SkillPi interpretation

Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: dlt
description: >-
  You are an expert in dlt, the open-source Python library for building data
  pipelines. You help developers load data from any API, file, or database
  into warehouses and lakes using simple Python decorators — with automatic
  schema inference, incremental loading, and built-in data contracts. dlt is
  the "requests library for data pipelines."
license: Apache-2.0
compatibility: ''
metadata:
  author: terminal-skills
  version: 1.0.0
  category: Data Engineering
  tags:
    - data-loading
    - python
    - etl
    - data-pipeline
    - ingestion
    - open-source

dlt (Data Load Tool) — Python-First Data Ingestion

You are an expert in dlt, the open-source Python library for building data pipelines. You help developers load data from any API, file, or database into warehouses and lakes using simple Python decorators — with automatic schema inference, incremental loading, and built-in data contracts. dlt is the "requests library for data pipelines."

Core Capabilities

Basic Pipeline

import dlt

# Simplest pipeline: Python generator → warehouse
@dlt.resource(write_disposition="append")
def github_events():
    """Load GitHub events for a repository."""
    import requests
    response = requests.get("https://api.github.com/repos/org/repo/events")
    yield from response.json()

# Run pipeline
pipeline = dlt.pipeline(
    pipeline_name="github_events",
    destination="bigquery",               # or: postgres, snowflake, duckdb, motherduck
    dataset_name="raw_github",
)
load_info = pipeline.run(github_events())
print(load_info)                          # Schema inferred automatically

Incremental Loading

@dlt.resource(
    write_disposition="merge",            # Upsert: update existing, insert new
    primary_key="id",
)
def orders(
    updated_at=dlt.sources.incremental(
        "updated_at",
        initial_value="2025-01-01T00:00:00Z"
    )
):
    """Load orders incrementally — only new/changed since last run.

    dlt tracks the cursor automatically between runs.
    No need to store state manually.
    """
    import requests
    page = 1
    while True:
        response = requests.get("https://api.shop.com/orders", params={
            "updated_after": updated_at.last_value,
            "page": page,
            "per_page": 100,
        })
        data = response.json()
        if not data:
            break
        yield from data
        page += 1

REST API Source (Declarative)

from dlt.sources.rest_api import rest_api_source

# Declarative API source — no code needed for standard REST APIs
source = rest_api_source({
    "client": {
        "base_url": "https://api.hubspot.com/crm/v3/",
        "auth": { "type": "bearer", "token": dlt.secrets["hubspot_token"] },
        "paginator": { "type": "offset", "limit": 100, "offset_param": "offset" },
    },
    "resources": [
        {
            "name": "contacts",
            "endpoint": { "path": "objects/contacts" },
            "write_disposition": "merge",
            "primary_key": "id",
        },
        {
            "name": "deals",
            "endpoint": { "path": "objects/deals" },
            "write_disposition": "merge",
            "primary_key": "id",
        },
    ],
})

pipeline = dlt.pipeline(destination="bigquery", dataset_name="raw_hubspot")
pipeline.run(source)

Data Contracts

# Enforce schema contracts — fail loudly on unexpected changes
@dlt.resource(
    write_disposition="merge",
    primary_key="id",
    columns={
        "id": {"data_type": "bigint", "nullable": False},
        "email": {"data_type": "text", "nullable": False},
        "plan": {"data_type": "text", "nullable": False},
        "mrr_cents": {"data_type": "bigint"},
    },
    schema_contract="evolve",             # "freeze" | "evolve" | "discard_value" | "discard_row"
)
def customers():
    # If API returns unexpected fields, dlt handles per contract setting
    yield from fetch_customers()

Installation

pip install dlt[bigquery]                 # + destination adapter
# Other destinations: dlt[snowflake], dlt[postgres], dlt[duckdb], dlt[motherduck]

Best Practices

  1. Start with DuckDB — Develop locally with destination="duckdb", switch to BigQuery/Snowflake for production
  2. Incremental for APIs — Use dlt.sources.incremental for stateful loading; dlt tracks cursor between runs
  3. REST API source — Use the declarative rest_api_source for standard REST APIs; write custom resources only for complex APIs
  4. Merge for entities — Use write_disposition="merge" with primary_key for entity tables; append for event streams
  5. Schema contracts — Set schema_contract="freeze" in production to catch breaking API changes immediately
  6. Secrets management — Use dlt.secrets["key"] backed by environment variables or .dlt/secrets.toml
  7. Transformations — Use add_map() for row-level transforms during loading; heavier transforms belong in dbt
  8. Deploy anywhere — dlt is a library, not a service; deploy in cron, Airflow, Dagster, GitHub Actions, or Lambda

Current listing version

1.0.0

Verify the source revision ↗

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value95/100

Highlights

  • dlt 是一个用于构建数据管道的 Python 开源库,帮助开发者将数据从任意 API、文件或数据库加载到数据仓库和数据湖中,支持自动模式推断、增量加载和内置数据契约。
  • 这是一个非常实用的工具,适用于数据工程师和数据科学家,能够显著提升日常高频场景的效率。
Trigger Precision90/100

Highlights

  • 触发词精准完整,覆盖多种变体,边界清晰。
  • description 中明确描述了 dlt 的核心功能和用途,包括数据加载、自动模式推断、增量加载等,能够准确触发用户的需求。
Structure and Standards90/100

Highlights

  • Phase/步骤清晰,有出口条件,含端到端示例,frontmatter完整,单文件≤500行。
  • 文档结构清晰,包含了核心能力、安装、最佳实践等部分,每个部分都有详细的代码示例和说明,frontmatter 完整,单文件未超过500行。
Execution Reliability90/100

Highlights

  • 工具来源明确,参数正确,覆盖主要异常,不可逆操作有确认机制。
  • 文档中提供了详细的代码示例和最佳实践,工具来源明确,参数正确,覆盖了主要的使用场景和异常处理,不可逆操作有确认机制。
Evidence Verifiability (mean of the first four)91/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

  • Install or fetch external dependencies

    Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.

    Mentioned in main document · lines 141
Domains or addresses referenced in the document

These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.

  • api.github.com
  • api.hubspot.com
  • api.shop.com

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.