Credentials. Source and destination credentials come from secrets.toml or environment variables, so keep them out of your code.
Who it is forA developer who needs API data in a queryable table today.
The problemHand written extract scripts break on pagination and schema changes.
The outcomeA DuckDB dataset you can query, plus a DataFrame of the loaded table.
What you need first
- Python 3.10 through 3.14, with 3.14 support described as experimental
- `pip install dlt` plus the extras for your sources and destinations
- Credentials for your destination in secrets.toml or environment variables
Steps
- Install the library and the destination extra with
pip install dltandpip install "dlt[duckdb]" - Build a source with rest_api_source, giving the client base_url and a resource with its endpoint path
- Create the pipeline with DLT.pipeline, naming pipeline_name, destination and dataset_name, then call pipeline.run(source)
- Read the data straight back with pipeline.dataset() and .df()
Prompt for your agent
Using dlt-hub/dlt, write a pipeline that loads <my API endpoint> into DuckDB with rest_api_source and prints the first rows back as a DataFrame.
Caveat. Add the matching extra for any other destination, for example DLT[bigquery] or DLT[s3].
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for dlt-hub/dlt and "Pull a REST API into a local database"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer