profiles.yml tells dbt how to connect: which account, which user, which database and schema to build in. It is kept outside the project because it holds personal settings and credentials. One profile usually has two targets: dev, where you build in your own schema, and prod, used by the scheduler.

Copy and paste

# ~/.dbt/profiles.yml
shop:                                 # must match "profile:" in dbt_project.yml
  target: dev                         # the target used when no --target is given
  outputs:
    dev:
      type: snowflake
      account: myorg-myaccount
      user: NICOLA@EXAMPLE.COM
      authenticator: externalbrowser  # sign in with your company SSO
      role: TRANSFORMER_DEV
      database: ANALYTICS_DEV
      warehouse: TRANSFORMING
      schema: DBT_NICOLA
      threads: 8

    prod:
      type: snowflake
      account: myorg-myaccount
      user: DBT_SERVICE
      role: TRANSFORMER
      private_key_path: /secure/keys/rsa_key.p8
      private_key_passphrase: "{{ env_var('DBT_ENV_SECRET_KEY_PASSPHRASE') }}"
      database: ANALYTICS
      warehouse: TRANSFORMING
      schema: ANALYTICS
      threads: 16
      query_tag: dbt_prod
dbt debug                  # checks the dev target
dbt debug --target prod
dbt build --target prod

The fields

Field What it is
account the account identifier, in the orgname-accountname form shown in Snowsight
user the Snowflake user dbt signs in as
authentication one of: authenticator: externalbrowser (SSO), private_key_path or private_key (key pair), authenticator: username_password_mfa with password
role the role dbt uses; it overrides the user’s default role
database, schema where models go when they have no custom database or schema
warehouse the warehouse that runs the queries
threads how many models dbt builds at the same time

Optional fields include query_tag (labels dbt’s queries in Snowflake’s query history), client_session_keep_alive, connect_retries, connect_timeout and reuse_connections.

Where dbt looks for it

dbt uses the first profiles.yml it finds, in this order:

  1. the folder given with --profiles-dir;
  2. the folder in the DBT_PROFILES_DIR environment variable;
  3. the current folder, usually the project;
  4. ~/.dbt/.

dbt debug prints which file it used, which saves time when two copies exist.

Things to know

The profile was validated with dbt Core 1.12 and dbt-snowflake 1.12.4 (dbt debug reports profiles.yml file [OK found and valid]); the SSO target was not run.

References