Skip to main content

init

Improved in v1.0!

The init command is interactive and responsive like never before.

dbt init helps get you started using dbt Core!

New project

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 install the one you need)
  • prompt you for each piece of information that dbt needs to connect to that database: things like account, user, password, etc

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.

Existing project

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.

profile_template.yml

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.yml to 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.yml in 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.

profile_template.yml
fixed:
account: abc123
authenticator: externalbrowser
database: analytics
role: transformer
type: snowflake
warehouse: transforming
prompts:
user:
type: string
hint: yourname@jaffleshop.com
schema:
type: string
hint: usually dbt_<yourname>
threads:
hint: "your favorite number, 1-10"
type: int
default: 8
$ dbt init
Running with dbt=1.0.0-b2
Setting up your profile.
user (yourname@jaffleshop.com): summerintern@jaffleshop.com
schema (usually dbt_<yourname>): dbt_summerintern
threads (your favorite number, 1-10) [8]: 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.