dlt init command creates a new dlt pipeline script that loads data from a source to a destination.
Synopsis
Description
When you rundlt init, several things happen:
- Creates a basic project structure if the current folder is empty by adding
.dlt/config.toml,.dlt/secrets.toml, and.gitignorefiles - Checks if the
SOURCEargument matches one of the verified sources and, if so, adds it to your project - If the
SOURCEis unknown, uses a generic template to get you started - Rewrites the pipeline scripts to use your
DESTINATION - Creates sample config and credentials in
secrets.tomlandconfig.tomlfor the specified source and destination - Creates
requirements.txtwith dependencies required by the source and destination (if one doesn’t exist)
Arguments
SOURCE
Name of the data source for which to create a pipeline. Can be:- A verified source (e.g.,
github,stripe,google_analytics) - A core source (e.g.,
sql_database,rest_api,filesystem) - A template name for a custom pipeline
- A dlthub source prefixed with
dlthub:(e.g.,dlthub:myapi)
DESTINATION
Name of the destination where data will be loaded. Examples:bigquerysnowflakeredshiftpostgresduckdbfilesystemmotherduck
Options
—list-sources, -l
Shows all available verified sources with descriptions. For each source, checks if your local dlt version requires an update.—list-destinations
Shows the names of all core dlt destinations.—location
Advanced option. Specifies a custom URL or local path to the verified sources repository.https://github.com/dlt-hub/verified-sources.git
—branch
Advanced option. Uses a specific branch of the verified sources repository.—eject
Ejects the source code of core sources (likesql_database or rest_api) so they become editable.
--eject:
- Source code will be copied into your project
- You’ll need to modify the pipeline script to import from the ejected source
- Useful when you need to customize core source behavior
Examples
Initialize a GitHub to BigQuery Pipeline
Create a Custom Pipeline with Template
Initialize with dlthub Source
Eject a Core Source
sql_database source code into your project for customization.
Update Existing Source
- Detect modified files and ask how to handle conflicts
- Give options to Skip, Apply (overwrite), or Merge changes
- Preserve your local modifications when possible
Project Structure
After runningdlt init github bigquery, your project structure will look like:
Configuration Files
.dlt/secrets.toml
Contains credentials for sources and destinations:.dlt/config.toml
Contains non-sensitive configuration:Version Compatibility
If a source requires a newer version of dlt than currently installed, you’ll see a warning:Troubleshooting
Invalid Source Name
Source names must be valid Python identifiers (snake_case):Pipeline Script Already Exists
If you try to initialize a source that already has a pipeline script:See Also
- dlt pipeline - Inspect and manage pipelines
- dlt deploy - Deploy pipelines to production
- Walkthroughs: Create a Pipeline
- Walkthroughs: Add a Verified Source