/sql-database-pipeline:debug-sql-database-pipeline [pipeline-name] [issue]from sql-database-pipeline
Debugs and inspects dlt SQL database pipelines after runs. Diagnoses connection failures, missing credentials, driver issues, and failed load jobs using traces and schema inspection.
Ships in sql-database-pipeline. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Essential Reading:
Parse $ARGUMENTS:
pipeline-name (optional): the dlt pipeline name. If omitted, infer from session context. If ambiguous, ask the user and stop.hints (optional, after --): specific issue to investigateAlways do this first before any pipeline debugging:
IMPORTANT: Note the current values before changing them so you can restore exactly what you changed — only revert what YOU modified.
Set log level to INFO in .dlt/config.toml:
[runtime]
log_level = "INFO"
Add progress logging to the dlt.pipeline() call:
pipeline = dlt.pipeline(..., progress="log")
NOTE: progress goes on dlt.pipeline(), not on pipeline.run() — that argument does not exist on run().
This shows SQL queries being executed, rows fetched, reflection steps, and normalize/load progress.
uv run python <source>_pipeline.py
| Exception | Cause |
|---|---|
ConfigFieldMissingException | A credentials field is missing or misnamed in secrets.toml — check the section name and field names exactly |
OperationalError / Can't connect | Wrong host, port, or credentials; DB not reachable from this network |
ModuleNotFoundError: No module named 'sqlalchemy' | Run uv add "dlt[hub,sql_database]" |
ModuleNotFoundError: No module named 'pymysql' | Install the dialect driver, e.g. uv add pymysql |
MissingDependencyException: numpy required | The pyarrow backend also needs numpy: uv add numpy |
NoSuchTableError | Table name or schema is wrong — check spelling and schema parameter |
PipelineStepFailed at extract | Check the full traceback; usually a connection or reflection error |
schema=, verify the schema name is correctDESCRIBE <table> or SELECT COUNT(*) FROM <table> directly against the DB to confirm data existsLarge tables with no add_limit() can take a long time — check progress="log" output to confirm rows are flowing. If truly stuck:
WHERE clause via query_adapter_callbackchunk_size=100 to reduce memory pressure and confirm rows are trickling throughsource = sql_database(table_names=["orders", "users"])
pipeline.run(source.with_resources("orders").add_limit(1))
Check that table_names is set on the source, not filtered via .with_resources().
sql_database() without table_names reflects the entire schema before filtering — slow on large databases. Always pass the tables you need upfront:
# good — reflects only these two tables
source = sql_database(table_names=["family", "clan"])
# slow — reflects all tables in the schema first, then filters
source = sql_database().with_resources("family", "clan")
Check the backend — this is the most common cause of slow pipelines.
The default sqlalchemy backend fetches rows one at a time through Python objects. Switch to a faster backend:
Use pyarrow (~15x faster end to end on flat tables in a local benchmark; needs numpy). Use connectorx only if the table fits in RAM. For trade-offs, see "Faster backend" in optimize-sql-performance.
Apply by passing backend= to sql_table or sql_database:
source = sql_database(table_names=["orders"], backend="pyarrow")
# or
source = sql_database(table_names=["orders"], backend="connectorx")
Inspect pipeline state to check the stored cursor value:
uv run dlthub -v local pipeline info <pipeline_name>
Look for last_value in the resource state — verify it updates between runs. Also check logs for "Bind incremental on <resource_name>" to confirm the incremental param was bound.
Ref: https://dlthub.com/docs/general-usage/incremental/troubleshooting.md
Inspect the last pipeline run:
uv run dlthub -vv local pipeline trace <pipeline_name>
Shows credentials resolution, step timing, and failures.
Each pipeline run generated one or more load packages. Use trace tool to find their ids.
uv run dlthub -v local pipeline load-package <pipeline_name> # most recent package
uv run dlthub -v local pipeline load-package <pipeline_name> <load_id> # specific package
uv run dlthub local pipeline load-package <pipeline_name> <load_id> job <pattern> # full error history of matching jobs, across retries
Shows package state, per-job details (table, file type, size, timing), and error messages for failed jobs, including jobs pending a retry. With -v also shows the tables and columns created at the destination.
A failed load job stays pending. Since dlt 1.30, a job that fails on load is queued for retry, its package stays pending and the run raises LoadClientJobTerminalRetry. Read the job with load-package above. To recover a package that cannot load (retry, fail a job, abort), see troubleshoot-pipeline-run, section Recover a failed load.
uv run dlthub local pipeline failed-jobs <pipeline_name>
Scans completed packages for failed jobs and displays error messages from the destination. It does not list a job that is pending a retry.
A pipeline's working directory is .dlt/state/<profile>/pipelines/<pipeline_name>/. The profile is dev unless another one is pinned (uv run dlthub profile info). Completed packages are stored under load/loaded/<load_id>/, with job files in completed_jobs/ and failed_jobs/ subdirectories.
File format depends on the destination:
| Format | Default for | File extension |
|---|---|---|
| INSERT VALUES | duckdb, postgres, redshift, mssql, motherduck | .insert_values.gz |
| JSONL | bigquery, snowflake, filesystem | .jsonl.gz |
| Parquet | athena, databricks (also supported by duckdb, bigquery, snowflake) | .parquet |
| CSV | filesystem | .csv.gz |
Inspect gzipped files with zcat:
zcat .dlt/state/<profile>/pipelines/<pipeline_name>/load/loaded/<load_id>/completed_jobs/<file>.gz
Useful for verifying data transformations and debugging destination errors.
Before moving on, revert all debugging settings YOU introduced:
.dlt/config.toml — restore log_level to its previous value (or remove if you added it)progress="log" from dlt.pipeline() if you added it. Remove .add_limit(N) if you added it for debugging.Do NOT remove settings the user had before you started.
validate-sql-database-data to inspect schema and data, or hand over to explore-data (data-exploration toolkit) to jump straight into charts and analysiscreate-sql-database-pipeline — "Set up config and secrets" sectioncreate-sql-database-pipeline to scaffold one firstWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub dlt-hub/dlthub-ai-harness --plugin sql-database-pipeline8 skills in this plugin
/add-tableAdd a new table or view to an existing dlt SQL database pipeline. Use when the user wants to load additional tables from the same database that already has a working pipeline./adjust-tableAdjust a working dlt SQL database pipeline for production — remove dev limits, add incremental loading, configure merge keys. Use when the user wants to remove .add_limit(), load the full table, or set up incremental loading on a cursor column. For speed/memory tuning (backend, chunk size, parallelism) use optimize-sql-performance instead. For inspecting loaded data or fixing column types/schema after a load, use validate-sql-database-data instead./Other plugins' skills for the same job