About dbt init command
init command is interactive and responsive like never before.
dbt init helps get you started using dbt Core!
If this is your first time ever using the tool, it will:
- ask you to name your project
- ask you which database adapter you're using (or to Supported Data Platforms)
- prompt you for each piece of information that dbt needs to connect to that database: things like
Then, it will:
- Create a new folder with your project name and sample files, enough to get you started with dbt
- Create a connection profile on your local machine. The default location is
~/.dbt/profiles.yml. Read more in configuring your profile.
If you've just cloned or downloaded an existing dbt project,
dbt init can still help you set up your connection profile so that you can start working quickly. It will prompt you for connection information, as above, and add a profile (using the
profile name from the project) to your local
profiles.yml, or create the file if it doesn't already exist.
dbt init knows how to prompt for connection information by looking for a file named
profile_template.yml. It will look for this file in two places:
Adapter plugin: What's the bare minumum Postgres profile? What's the type of each field, what are its defaults? This information is stored in a file called
dbt/include/postgres/profile_template.yml. If you're the maintainer of an adapter plugin, we highly recommend that you add a
profile_template.ymlto your plugin, too. See more details in building-a-new-adapter.
Existing project: If you're the maintainer of an existing project, and you want to help new users get connected to your database quickly and easily, you can include your own custom
profile_template.ymlin the root of your project, alongside
dbt_project.yml. For common connection attributes, set the values in
fixed; leave user-specific attributes in
prompts, but with custom hints and defaults as you'd like.
hint: usually dbt_<yourname>
hint: "your favorite number, 1-10"
$ dbt init
Running with dbt=1.0.0-b2
Setting up your profile.
user (firstname.lastname@example.org): email@example.com
schema (usually dbt_<yourname>): dbt_summerintern
threads (your favorite number, 1-10) : 6
Profile internal-snowflake written to /Users/intern/.dbt/profiles.yml using project's profile_template.yml and your supplied values. Run 'dbt debug' to validate the connection.